Aiming Wu
/
Flappy_Bird
Implement basic functions
Diff: Bird/Bird.cpp
- Revision:
- 0:64bd9f996099
diff -r 000000000000 -r 64bd9f996099 Bird/Bird.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Bird/Bird.cpp Fri May 03 13:05:24 2019 +0000 @@ -0,0 +1,54 @@ +#include "Bird.h" + +Bird::Bird() +{ + +} + +Bird::~Bird() +{ + +} + +void Bird::init() +{ + _h = 16; +} + +int Bird::draw(N5110 &lcd,Gamepad &pad) +{ + int sprite_data1[] = { + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,1,0,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,1,0,0, + 0,0,0,1,1,1,0,0, + 1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + }; + int sprite_data2[] = { + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,0, + 1,1,1,1,1,1,1,1, + 0,0,0,1,1,1,0,0, + 0,0,0,1,1,1,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + }; + if(pad.check_event(Gamepad::A_PRESSED) == true){ + _h = _h - 7; + Bitmap sprite(sprite_data1, 10, 8); + sprite.render(lcd,1,_h); + }else{ + _h = _h + 3; + Bitmap sprite(sprite_data2, 10, 8); + sprite.render(lcd,1,_h); + } + return _h; +} \ No newline at end of file