![](/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.
main.cpp@4:8e3ba8d6d915, 2020-05-22 (annotated)
- Committer:
- MatisRequis
- Date:
- Fri May 22 10:29:49 2020 +0000
- Revision:
- 4:8e3ba8d6d915
- Parent:
- 2:d59a92e65bd9
- Child:
- 10:2ae9d4145410
Hero movement done, now depends on joystick position
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
eencae | 0:b7f1f47bb26a | 1 | /* |
eencae | 0:b7f1f47bb26a | 2 | ELEC2645 Embedded Systems Project |
eencae | 0:b7f1f47bb26a | 3 | School of Electronic & Electrical Engineering |
eencae | 0:b7f1f47bb26a | 4 | University of Leeds |
eencae | 0:b7f1f47bb26a | 5 | 2019/20 |
eencae | 0:b7f1f47bb26a | 6 | |
MatisRequis | 1:03d1c29c2f8a | 7 | Name:Matis Requis |
MatisRequis | 1:03d1c29c2f8a | 8 | Username:el18mrjr |
MatisRequis | 1:03d1c29c2f8a | 9 | Student ID Number:201241242 |
MatisRequis | 1:03d1c29c2f8a | 10 | Date:20/04/20 |
eencae | 0:b7f1f47bb26a | 11 | */ |
eencae | 0:b7f1f47bb26a | 12 | |
eencae | 0:b7f1f47bb26a | 13 | // includes |
eencae | 0:b7f1f47bb26a | 14 | #include "mbed.h" |
eencae | 0:b7f1f47bb26a | 15 | #include "Gamepad.h" |
eencae | 0:b7f1f47bb26a | 16 | #include "N5110.h" |
MatisRequis | 2:d59a92e65bd9 | 17 | #include "TempestEngine.h" |
eencae | 0:b7f1f47bb26a | 18 | |
eencae | 0:b7f1f47bb26a | 19 | |
eencae | 0:b7f1f47bb26a | 20 | // objects |
eencae | 0:b7f1f47bb26a | 21 | Gamepad pad; |
eencae | 0:b7f1f47bb26a | 22 | N5110 lcd; |
MatisRequis | 2:d59a92e65bd9 | 23 | TempestEngine tempest; |
MatisRequis | 2:d59a92e65bd9 | 24 | |
MatisRequis | 2:d59a92e65bd9 | 25 | //prototypes |
MatisRequis | 2:d59a92e65bd9 | 26 | void init(); |
MatisRequis | 2:d59a92e65bd9 | 27 | void render(); |
MatisRequis | 2:d59a92e65bd9 | 28 | |
eencae | 0:b7f1f47bb26a | 29 | |
eencae | 0:b7f1f47bb26a | 30 | int main() |
eencae | 0:b7f1f47bb26a | 31 | { |
MatisRequis | 4:8e3ba8d6d915 | 32 | int fps = 5; |
eencae | 0:b7f1f47bb26a | 33 | |
MatisRequis | 2:d59a92e65bd9 | 34 | init(); |
MatisRequis | 2:d59a92e65bd9 | 35 | |
MatisRequis | 2:d59a92e65bd9 | 36 | render(); |
MatisRequis | 2:d59a92e65bd9 | 37 | wait(1.0f/fps); |
MatisRequis | 4:8e3ba8d6d915 | 38 | |
MatisRequis | 4:8e3ba8d6d915 | 39 | while (1) { |
MatisRequis | 4:8e3ba8d6d915 | 40 | tempest.read_input(pad); |
MatisRequis | 4:8e3ba8d6d915 | 41 | tempest.update(); |
MatisRequis | 4:8e3ba8d6d915 | 42 | render(); |
MatisRequis | 4:8e3ba8d6d915 | 43 | wait(1.0f/fps); |
MatisRequis | 4:8e3ba8d6d915 | 44 | } |
eencae | 0:b7f1f47bb26a | 45 | } |
eencae | 0:b7f1f47bb26a | 46 | |
MatisRequis | 2:d59a92e65bd9 | 47 | void init() { |
MatisRequis | 2:d59a92e65bd9 | 48 | lcd.init(); |
MatisRequis | 2:d59a92e65bd9 | 49 | pad.init(); |
MatisRequis | 4:8e3ba8d6d915 | 50 | tempest.init(); |
MatisRequis | 4:8e3ba8d6d915 | 51 | |
MatisRequis | 2:d59a92e65bd9 | 52 | } |
MatisRequis | 2:d59a92e65bd9 | 53 | |
MatisRequis | 2:d59a92e65bd9 | 54 | void render() { |
MatisRequis | 2:d59a92e65bd9 | 55 | lcd.clear(); |
MatisRequis | 2:d59a92e65bd9 | 56 | tempest.draw(lcd); |
MatisRequis | 2:d59a92e65bd9 | 57 | lcd.refresh(); |
MatisRequis | 4:8e3ba8d6d915 | 58 | } |