Aiming Wu
/
Game
Implement basic functions.
Wall/Wall.cpp@0:7173d91b03e1, 2019-05-03 (annotated)
- Committer:
- Wuuu
- Date:
- Fri May 03 13:03:59 2019 +0000
- Revision:
- 0:7173d91b03e1
Copter, which with header programme.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wuuu | 0:7173d91b03e1 | 1 | #include "Wall.h" |
Wuuu | 0:7173d91b03e1 | 2 | |
Wuuu | 0:7173d91b03e1 | 3 | Wall::Wall() |
Wuuu | 0:7173d91b03e1 | 4 | { |
Wuuu | 0:7173d91b03e1 | 5 | |
Wuuu | 0:7173d91b03e1 | 6 | } |
Wuuu | 0:7173d91b03e1 | 7 | |
Wuuu | 0:7173d91b03e1 | 8 | Wall::~Wall() |
Wuuu | 0:7173d91b03e1 | 9 | { |
Wuuu | 0:7173d91b03e1 | 10 | |
Wuuu | 0:7173d91b03e1 | 11 | } |
Wuuu | 0:7173d91b03e1 | 12 | |
Wuuu | 0:7173d91b03e1 | 13 | void Wall::init() |
Wuuu | 0:7173d91b03e1 | 14 | { |
Wuuu | 0:7173d91b03e1 | 15 | _a1 = 20; |
Wuuu | 0:7173d91b03e1 | 16 | _a2 = 20; |
Wuuu | 0:7173d91b03e1 | 17 | _a3 = 20; |
Wuuu | 0:7173d91b03e1 | 18 | _a4 = 20; |
Wuuu | 0:7173d91b03e1 | 19 | _a5 = 20; |
Wuuu | 0:7173d91b03e1 | 20 | _a6 = 20; |
Wuuu | 0:7173d91b03e1 | 21 | _a7 = 20; |
Wuuu | 0:7173d91b03e1 | 22 | _a8 = 20; |
Wuuu | 0:7173d91b03e1 | 23 | _a9 = 20; |
Wuuu | 0:7173d91b03e1 | 24 | _a10 = 20; |
Wuuu | 0:7173d91b03e1 | 25 | _a11 = 20; |
Wuuu | 0:7173d91b03e1 | 26 | _a12 = 20; |
Wuuu | 0:7173d91b03e1 | 27 | _b1 = 20; |
Wuuu | 0:7173d91b03e1 | 28 | _b2 = 20; |
Wuuu | 0:7173d91b03e1 | 29 | _b3 = 20; |
Wuuu | 0:7173d91b03e1 | 30 | _b4 = 20; |
Wuuu | 0:7173d91b03e1 | 31 | _b5 = 20; |
Wuuu | 0:7173d91b03e1 | 32 | _b6 = 20; |
Wuuu | 0:7173d91b03e1 | 33 | _b7 = 20; |
Wuuu | 0:7173d91b03e1 | 34 | _b8 = 20; |
Wuuu | 0:7173d91b03e1 | 35 | _b9 = 20; |
Wuuu | 0:7173d91b03e1 | 36 | _b10 = 20; |
Wuuu | 0:7173d91b03e1 | 37 | _b11 = 20; |
Wuuu | 0:7173d91b03e1 | 38 | _b12 = 20; |
Wuuu | 0:7173d91b03e1 | 39 | _ab = new int[2]; |
Wuuu | 0:7173d91b03e1 | 40 | _ab[0] = 0; |
Wuuu | 0:7173d91b03e1 | 41 | _ab[1] = 0; |
Wuuu | 0:7173d91b03e1 | 42 | } |
Wuuu | 0:7173d91b03e1 | 43 | |
Wuuu | 0:7173d91b03e1 | 44 | int* Wall::draw(N5110 &lcd) |
Wuuu | 0:7173d91b03e1 | 45 | { |
Wuuu | 0:7173d91b03e1 | 46 | _a1 = _a2; |
Wuuu | 0:7173d91b03e1 | 47 | _a2 = _a3; |
Wuuu | 0:7173d91b03e1 | 48 | _a3 = _a4; |
Wuuu | 0:7173d91b03e1 | 49 | _a4 = _a5; |
Wuuu | 0:7173d91b03e1 | 50 | _a5 = _a6; |
Wuuu | 0:7173d91b03e1 | 51 | _a6 = _a7; |
Wuuu | 0:7173d91b03e1 | 52 | _a7 = _a8; |
Wuuu | 0:7173d91b03e1 | 53 | _a8 = _a9; |
Wuuu | 0:7173d91b03e1 | 54 | _a9 = _a10; |
Wuuu | 0:7173d91b03e1 | 55 | _a10 = _a11; |
Wuuu | 0:7173d91b03e1 | 56 | _a11 = _a12; |
Wuuu | 0:7173d91b03e1 | 57 | _a12 = rand() % 10 + 5; |
Wuuu | 0:7173d91b03e1 | 58 | _b1 = _b2; |
Wuuu | 0:7173d91b03e1 | 59 | _b2 = _b3; |
Wuuu | 0:7173d91b03e1 | 60 | _b3 = _b4; |
Wuuu | 0:7173d91b03e1 | 61 | _b4 = _b5; |
Wuuu | 0:7173d91b03e1 | 62 | _b5 = _b6; |
Wuuu | 0:7173d91b03e1 | 63 | _b6 = _b7; |
Wuuu | 0:7173d91b03e1 | 64 | _b7 = _b8; |
Wuuu | 0:7173d91b03e1 | 65 | _b8 = _b9; |
Wuuu | 0:7173d91b03e1 | 66 | _b9 = _b10; |
Wuuu | 0:7173d91b03e1 | 67 | _b10 = _b11; |
Wuuu | 0:7173d91b03e1 | 68 | _b11 = _b12; |
Wuuu | 0:7173d91b03e1 | 69 | _b12 = rand() % 6 + 14; |
Wuuu | 0:7173d91b03e1 | 70 | lcd.drawRect(0,8,7,_b1-_a1,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 71 | lcd.drawRect(0,8+_a1+_b1,7,40-_a1-_b1,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 72 | lcd.drawRect(7,8,7,_b2-_a2,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 73 | lcd.drawRect(7,8+_a2+_b2,7,40-_a2-_b2,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 74 | lcd.drawRect(14,8,7,_b3-_a3,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 75 | lcd.drawRect(14,8+_a3+_b3,7,40-_a3-_b3,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 76 | lcd.drawRect(21,8,7,_b4-_a4,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 77 | lcd.drawRect(21,8+_a4+_b4,7,40-_a4-_b4,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 78 | lcd.drawRect(28,8,7,_b5-_a5,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 79 | lcd.drawRect(28,8+_a5+_b5,7,40-_a5-_b5,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 80 | lcd.drawRect(35,8,7,_b6-_a6,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 81 | lcd.drawRect(35,8+_a6+_b6,7,40-_a6-_b6,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 82 | lcd.drawRect(42,8,7,_b7-_a7,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 83 | lcd.drawRect(42,8+_a7+_b7,7,40-_a7-_b7,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 84 | lcd.drawRect(49,8,7,_b8-_a8,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 85 | lcd.drawRect(49,8+_a8+_b8,7,40-_a8-_b8,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 86 | lcd.drawRect(56,8,7,_b9-_a9,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 87 | lcd.drawRect(56,8+_a9+_b9,7,40-_a9-_b9,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 88 | lcd.drawRect(63,8,7,_b10-_a10,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 89 | lcd.drawRect(63,8+_a10+_b10,7,40-_a10-_b10,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 90 | lcd.drawRect(70,8,7,_b11-_a11,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 91 | lcd.drawRect(70,8+_a11+_b11,7,40-_a11-_b11,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 92 | lcd.drawRect(77,8,7,_b12-_a12,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 93 | lcd.drawRect(77,8+_a12+_b12,7,40-_a12-_b12,FILL_BLACK); |
Wuuu | 0:7173d91b03e1 | 94 | _ab[0] = _a1; |
Wuuu | 0:7173d91b03e1 | 95 | _ab[1] = _b1; |
Wuuu | 0:7173d91b03e1 | 96 | return _ab; |
Wuuu | 0:7173d91b03e1 | 97 | } |