Aiming Wu
/
2645_Assignment
Doxyjen of the Bird.h
Game1/Game1.cpp@6:0912dfea40f5, 2019-05-05 (annotated)
- Committer:
- Wuuu
- Date:
- Sun May 05 17:46:26 2019 +0000
- Revision:
- 6:0912dfea40f5
- Parent:
- 0:0aea7b9ba421
Final Submission. I have read and agreed with Statement of Academic Integrity.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wuuu | 0:0aea7b9ba421 | 1 | #include "Game1.h" |
Wuuu | 0:0aea7b9ba421 | 2 | |
Wuuu | 0:0aea7b9ba421 | 3 | Game1::Game1() |
Wuuu | 0:0aea7b9ba421 | 4 | { |
Wuuu | 0:0aea7b9ba421 | 5 | |
Wuuu | 0:0aea7b9ba421 | 6 | } |
Wuuu | 0:0aea7b9ba421 | 7 | |
Wuuu | 0:0aea7b9ba421 | 8 | Game1::~Game1() |
Wuuu | 0:0aea7b9ba421 | 9 | { |
Wuuu | 0:0aea7b9ba421 | 10 | |
Wuuu | 0:0aea7b9ba421 | 11 | } |
Wuuu | 0:0aea7b9ba421 | 12 | |
Wuuu | 0:0aea7b9ba421 | 13 | void Game1::init() |
Wuuu | 0:0aea7b9ba421 | 14 | { |
Wuuu | 0:0aea7b9ba421 | 15 | _m = 0; |
Wuuu | 0:0aea7b9ba421 | 16 | _s = 0; |
Wuuu | 0:0aea7b9ba421 | 17 | _a = 20; |
Wuuu | 0:0aea7b9ba421 | 18 | _b = 20; |
Wuuu | 0:0aea7b9ba421 | 19 | _Wall.init(); |
Wuuu | 0:0aea7b9ba421 | 20 | _Copter.init(); |
Wuuu | 0:0aea7b9ba421 | 21 | } |
Wuuu | 0:0aea7b9ba421 | 22 | |
Wuuu | 0:0aea7b9ba421 | 23 | int Game1::draw(N5110 &lcd, Gamepad &pad) |
Wuuu | 0:0aea7b9ba421 | 24 | { |
Wuuu | 0:0aea7b9ba421 | 25 | lcd.drawRect(0,8,84,40,FILL_TRANSPARENT); |
Wuuu | 0:0aea7b9ba421 | 26 | _Wall.draw(lcd); |
Wuuu | 0:0aea7b9ba421 | 27 | _Copter.get_coord(pad); |
Wuuu | 0:0aea7b9ba421 | 28 | _Copter.get_h(); |
Wuuu | 0:0aea7b9ba421 | 29 | _Copter.draw(lcd); |
Wuuu | 0:0aea7b9ba421 | 30 | _s = _Copter.get_score(); |
Wuuu | 0:0aea7b9ba421 | 31 | char buffer1[14]; |
Wuuu | 0:0aea7b9ba421 | 32 | sprintf(buffer1,"score: %2d ",_s); |
Wuuu | 0:0aea7b9ba421 | 33 | lcd.printString(buffer1,0,0); |
Wuuu | 0:0aea7b9ba421 | 34 | int* _ab = new int[2]; |
Wuuu | 0:0aea7b9ba421 | 35 | _ab = _Wall.draw(lcd); |
Wuuu | 0:0aea7b9ba421 | 36 | _a = _ab[0]; |
Wuuu | 0:0aea7b9ba421 | 37 | _b = _ab[1]; |
Wuuu | 0:0aea7b9ba421 | 38 | _c = _Copter.get_h(); |
Wuuu | 0:0aea7b9ba421 | 39 | int d = 8 + _b - _a; |
Wuuu | 0:0aea7b9ba421 | 40 | int e = 8 + _b + _a; |
Wuuu | 0:0aea7b9ba421 | 41 | if(d >= 21-_c | e <= 27-_c){ |
Wuuu | 0:0aea7b9ba421 | 42 | _m = 1; |
Wuuu | 0:0aea7b9ba421 | 43 | }else{ |
Wuuu | 0:0aea7b9ba421 | 44 | _m = 0; |
Wuuu | 0:0aea7b9ba421 | 45 | } |
Wuuu | 0:0aea7b9ba421 | 46 | return _m; |
Wuuu | 0:0aea7b9ba421 | 47 | } |
Wuuu | 0:0aea7b9ba421 | 48 | |
Wuuu | 0:0aea7b9ba421 | 49 | int Game1::get_score() { |
Wuuu | 0:0aea7b9ba421 | 50 | _s = _Copter.get_score(); |
Wuuu | 0:0aea7b9ba421 | 51 | return _s; |
Wuuu | 0:0aea7b9ba421 | 52 | } |