Aiming Wu
/
2645_Assignment
Doxyjen of the Bird.h
Diff: Game1/Game1.cpp
- Revision:
- 0:0aea7b9ba421
diff -r 000000000000 -r 0aea7b9ba421 Game1/Game1.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Game1/Game1.cpp Sun May 05 16:27:50 2019 +0000 @@ -0,0 +1,52 @@ +#include "Game1.h" + +Game1::Game1() +{ + +} + +Game1::~Game1() +{ + +} + +void Game1::init() +{ + _m = 0; + _s = 0; + _a = 20; + _b = 20; + _Wall.init(); + _Copter.init(); +} + +int Game1::draw(N5110 &lcd, Gamepad &pad) +{ + lcd.drawRect(0,8,84,40,FILL_TRANSPARENT); + _Wall.draw(lcd); + _Copter.get_coord(pad); + _Copter.get_h(); + _Copter.draw(lcd); + _s = _Copter.get_score(); + char buffer1[14]; + sprintf(buffer1,"score: %2d ",_s); + lcd.printString(buffer1,0,0); + int* _ab = new int[2]; + _ab = _Wall.draw(lcd); + _a = _ab[0]; + _b = _ab[1]; + _c = _Copter.get_h(); + int d = 8 + _b - _a; + int e = 8 + _b + _a; + if(d >= 21-_c | e <= 27-_c){ + _m = 1; + }else{ + _m = 0; + } + return _m; +} + +int Game1::get_score() { + _s = _Copter.get_score(); + return _s; +} \ No newline at end of file