勇帜 周
/
2645_Final_project_1
bird
bird/bird.cpp@0:3887ebee1b37, 2019-05-03 (annotated)
- Committer:
- 1013373474
- Date:
- Fri May 03 17:51:38 2019 +0000
- Revision:
- 0:3887ebee1b37
- Child:
- 1:8672e52115e3
fly bird
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
1013373474 | 0:3887ebee1b37 | 1 | #include "bird.h" |
1013373474 | 0:3887ebee1b37 | 2 | |
1013373474 | 0:3887ebee1b37 | 3 | |
1013373474 | 0:3887ebee1b37 | 4 | |
1013373474 | 0:3887ebee1b37 | 5 | void bird::init() |
1013373474 | 0:3887ebee1b37 | 6 | { |
1013373474 | 0:3887ebee1b37 | 7 | _y = 20; |
1013373474 | 0:3887ebee1b37 | 8 | } |
1013373474 | 0:3887ebee1b37 | 9 | |
1013373474 | 0:3887ebee1b37 | 10 | |
1013373474 | 0:3887ebee1b37 | 11 | void bird::draw(N5110 &lcd) |
1013373474 | 0:3887ebee1b37 | 12 | { |
1013373474 | 0:3887ebee1b37 | 13 | lcd.drawRect(30,_y,2,2,FILL_BLACK); |
1013373474 | 0:3887ebee1b37 | 14 | _y += 3; |
1013373474 | 0:3887ebee1b37 | 15 | } |
1013373474 | 0:3887ebee1b37 | 16 | |
1013373474 | 0:3887ebee1b37 | 17 | |
1013373474 | 0:3887ebee1b37 | 18 | void bird::check(Gamepad &pad) |
1013373474 | 0:3887ebee1b37 | 19 | { |
1013373474 | 0:3887ebee1b37 | 20 | while (pad.check_event(Gamepad::A_PRESSED) == true) { |
1013373474 | 0:3887ebee1b37 | 21 | _y -= 6; |
1013373474 | 0:3887ebee1b37 | 22 | } |
1013373474 | 0:3887ebee1b37 | 23 | } |
1013373474 | 0:3887ebee1b37 | 24 | |
1013373474 | 0:3887ebee1b37 | 25 | Data bird::get_data() |
1013373474 | 0:3887ebee1b37 | 26 | { |
1013373474 | 0:3887ebee1b37 | 27 | _data.y = _y; |
1013373474 | 0:3887ebee1b37 | 28 | return _data; |
1013373474 | 0:3887ebee1b37 | 29 | } |
1013373474 | 0:3887ebee1b37 | 30 | |
1013373474 | 0:3887ebee1b37 | 31 | |
1013373474 | 0:3887ebee1b37 | 32 | |
1013373474 | 0:3887ebee1b37 | 33 |