Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Engine/Engine.h@5:a3a9e0417e04, 2018-04-29 (annotated)
- Committer:
- Andrew_M
- Date:
- Sun Apr 29 18:03:45 2018 +0000
- Revision:
- 5:a3a9e0417e04
- Parent:
- 3:6253a2d374fa
- Child:
- 6:ed553fd191c2
Food class is now a thing, the snake grows when it eats and a game over state is reached when the snake eats it's own tail with a simple animation to demonstrate the game over state has been reached
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Andrew_M | 1:a14415de3ad5 | 1 | #include "mbed.h" |
Andrew_M | 1:a14415de3ad5 | 2 | #include "N5110.h" |
Andrew_M | 1:a14415de3ad5 | 3 | #include "Gamepad.h" |
Andrew_M | 1:a14415de3ad5 | 4 | #include "Snek.h" |
Andrew_M | 5:a3a9e0417e04 | 5 | #include "Food.h" |
Andrew_M | 1:a14415de3ad5 | 6 | |
Andrew_M | 1:a14415de3ad5 | 7 | class Engine |
Andrew_M | 1:a14415de3ad5 | 8 | { |
Andrew_M | 1:a14415de3ad5 | 9 | |
Andrew_M | 1:a14415de3ad5 | 10 | public: |
Andrew_M | 1:a14415de3ad5 | 11 | Engine(); |
Andrew_M | 1:a14415de3ad5 | 12 | ~Engine(); |
Andrew_M | 1:a14415de3ad5 | 13 | |
Andrew_M | 1:a14415de3ad5 | 14 | void init(); |
Andrew_M | 1:a14415de3ad5 | 15 | void read_input(Gamepad &pad); |
Andrew_M | 1:a14415de3ad5 | 16 | void update(Gamepad &pad); |
Andrew_M | 1:a14415de3ad5 | 17 | void draw(N5110 &lcd); |
Andrew_M | 5:a3a9e0417e04 | 18 | void changeScore(); |
Andrew_M | 5:a3a9e0417e04 | 19 | string convertString(int a); |
Andrew_M | 5:a3a9e0417e04 | 20 | void gameOver(N5110 &lcd); |
Andrew_M | 5:a3a9e0417e04 | 21 | |
Andrew_M | 1:a14415de3ad5 | 22 | private: |
Andrew_M | 5:a3a9e0417e04 | 23 | |
Andrew_M | 5:a3a9e0417e04 | 24 | int _score; |
Andrew_M | 1:a14415de3ad5 | 25 | Direction _d; |
Andrew_M | 2:9ca5e1c221c3 | 26 | int _grid[22][22]; |
Andrew_M | 2:9ca5e1c221c3 | 27 | Snek _solid; |
Andrew_M | 5:a3a9e0417e04 | 28 | Food _noodles; |
Andrew_M | 5:a3a9e0417e04 | 29 | bool _gameOver; |
Andrew_M | 1:a14415de3ad5 | 30 | }; |