![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Matis Requis 201241242
Dependencies: mbed
Tempest Game
Game Screen
The board is made of 12 columns. The Hero stays at the top of the column
Game Controls
To control the hero spaceship point the joystick to the column you want the hero to go to.
Press the A button to shoot a bullet in the column you are currently in.
TempestEngine/TempestEngine.cpp@4:8e3ba8d6d915, 2020-05-22 (annotated)
- Committer:
- MatisRequis
- Date:
- Fri May 22 10:29:49 2020 +0000
- Revision:
- 4:8e3ba8d6d915
- Parent:
- 3:54132cf073d7
- Child:
- 6:037dfa5064a1
Hero movement done, now depends on joystick position
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MatisRequis | 2:d59a92e65bd9 | 1 | #include "TempestEngine.h" |
MatisRequis | 2:d59a92e65bd9 | 2 | |
MatisRequis | 2:d59a92e65bd9 | 3 | TempestEngine::TempestEngine() { |
MatisRequis | 2:d59a92e65bd9 | 4 | |
MatisRequis | 2:d59a92e65bd9 | 5 | } |
MatisRequis | 2:d59a92e65bd9 | 6 | |
MatisRequis | 2:d59a92e65bd9 | 7 | TempestEngine::~TempestEngine() { |
MatisRequis | 2:d59a92e65bd9 | 8 | |
MatisRequis | 2:d59a92e65bd9 | 9 | } |
MatisRequis | 2:d59a92e65bd9 | 10 | |
MatisRequis | 2:d59a92e65bd9 | 11 | |
MatisRequis | 4:8e3ba8d6d915 | 12 | void TempestEngine::init() { |
MatisRequis | 4:8e3ba8d6d915 | 13 | _hero.init(0); |
MatisRequis | 2:d59a92e65bd9 | 14 | } |
MatisRequis | 2:d59a92e65bd9 | 15 | |
MatisRequis | 4:8e3ba8d6d915 | 16 | |
MatisRequis | 2:d59a92e65bd9 | 17 | void TempestEngine::draw(N5110 &lcd) { |
MatisRequis | 3:54132cf073d7 | 18 | _board.draw(lcd); |
MatisRequis | 4:8e3ba8d6d915 | 19 | |
MatisRequis | 4:8e3ba8d6d915 | 20 | //draw hero ship |
MatisRequis | 4:8e3ba8d6d915 | 21 | _hero.draw(lcd); |
MatisRequis | 4:8e3ba8d6d915 | 22 | |
MatisRequis | 2:d59a92e65bd9 | 23 | /* |
MatisRequis | 2:d59a92e65bd9 | 24 | //score |
MatisRequis | 2:d59a92e65bd9 | 25 | print_score(lcd); |
MatisRequis | 2:d59a92e65bd9 | 26 | |
MatisRequis | 4:8e3ba8d6d915 | 27 | |
MatisRequis | 2:d59a92e65bd9 | 28 | |
MatisRequis | 2:d59a92e65bd9 | 29 | //draw ennemies |
MatisRequis | 2:d59a92e65bd9 | 30 | _ennemy.draw(lcd); |
MatisRequis | 2:d59a92e65bd9 | 31 | |
MatisRequis | 2:d59a92e65bd9 | 32 | //draw bullets |
MatisRequis | 2:d59a92e65bd9 | 33 | _bullet.draw(lcd); */ |
MatisRequis | 2:d59a92e65bd9 | 34 | |
MatisRequis | 4:8e3ba8d6d915 | 35 | } |
MatisRequis | 4:8e3ba8d6d915 | 36 | void TempestEngine::read_input(Gamepad &pad) { |
MatisRequis | 4:8e3ba8d6d915 | 37 | _d = pad.get_angle(); |
MatisRequis | 4:8e3ba8d6d915 | 38 | _mag = pad.get_mag(); |
MatisRequis | 4:8e3ba8d6d915 | 39 | _a = pad.A_pressed(); |
MatisRequis | 4:8e3ba8d6d915 | 40 | } |
MatisRequis | 4:8e3ba8d6d915 | 41 | |
MatisRequis | 4:8e3ba8d6d915 | 42 | |
MatisRequis | 4:8e3ba8d6d915 | 43 | void TempestEngine::update() { |
MatisRequis | 4:8e3ba8d6d915 | 44 | _hero.update(_d, _mag, _a); |
MatisRequis | 4:8e3ba8d6d915 | 45 | } |