bird

Dependencies:   mbed

Committer:
1013373474
Date:
Sat May 04 10:24:57 2019 +0000
Revision:
1:8672e52115e3
Parent:
0:3887ebee1b37
fly bird

Who changed what in which revision?

UserRevisionLine numberNew 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 1:8672e52115e3 13 lcd.drawRect(30,_y,4,2,FILL_BLACK);
1013373474 1:8672e52115e3 14 lcd.drawRect(32,_y+2,1,1,FILL_BLACK);
1013373474 0:3887ebee1b37 15 _y += 3;
1013373474 0:3887ebee1b37 16 }
1013373474 0:3887ebee1b37 17
1013373474 0:3887ebee1b37 18
1013373474 1:8672e52115e3 19 void bird::check(Gamepad &pad, N5110 &lcd)
1013373474 0:3887ebee1b37 20 {
1013373474 0:3887ebee1b37 21 while (pad.check_event(Gamepad::A_PRESSED) == true) {
1013373474 0:3887ebee1b37 22 _y -= 6;
1013373474 1:8672e52115e3 23 lcd.drawRect(32,_y+2,1,1,FILL_TRANSPARENT);
1013373474 1:8672e52115e3 24
1013373474 0:3887ebee1b37 25 }
1013373474 0:3887ebee1b37 26 }
1013373474 0:3887ebee1b37 27
1013373474 0:3887ebee1b37 28 Data bird::get_data()
1013373474 0:3887ebee1b37 29 {
1013373474 0:3887ebee1b37 30 _data.y = _y;
1013373474 0:3887ebee1b37 31 return _data;
1013373474 0:3887ebee1b37 32 }
1013373474 0:3887ebee1b37 33
1013373474 0:3887ebee1b37 34
1013373474 0:3887ebee1b37 35
1013373474 0:3887ebee1b37 36