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.
Dependencies: mbed
Game/Game.h@2:7fa08670b1fc, 2020-05-26 (annotated)
- Committer:
- ale_carb0ni
- Date:
- Tue May 26 16:26:12 2020 +0000
- Revision:
- 2:7fa08670b1fc
- Child:
- 3:c61d0c70eda4
"working" classes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ale_carb0ni | 2:7fa08670b1fc | 1 | #ifndef GAME_H |
ale_carb0ni | 2:7fa08670b1fc | 2 | #define GAME_H |
ale_carb0ni | 2:7fa08670b1fc | 3 | |
ale_carb0ni | 2:7fa08670b1fc | 4 | #include "mbed.h" |
ale_carb0ni | 2:7fa08670b1fc | 5 | #include "Gamepad.h" |
ale_carb0ni | 2:7fa08670b1fc | 6 | #include "N5110.h" |
ale_carb0ni | 2:7fa08670b1fc | 7 | #include <vector> |
ale_carb0ni | 2:7fa08670b1fc | 8 | #include "Menu.h" |
ale_carb0ni | 2:7fa08670b1fc | 9 | |
ale_carb0ni | 2:7fa08670b1fc | 10 | class Game |
ale_carb0ni | 2:7fa08670b1fc | 11 | { |
ale_carb0ni | 2:7fa08670b1fc | 12 | |
ale_carb0ni | 2:7fa08670b1fc | 13 | private: |
ale_carb0ni | 2:7fa08670b1fc | 14 | |
ale_carb0ni | 2:7fa08670b1fc | 15 | int x; |
ale_carb0ni | 2:7fa08670b1fc | 16 | int y; |
ale_carb0ni | 2:7fa08670b1fc | 17 | int fruitX [16]; |
ale_carb0ni | 2:7fa08670b1fc | 18 | int fruitY [9]; |
ale_carb0ni | 2:7fa08670b1fc | 19 | int score; |
ale_carb0ni | 2:7fa08670b1fc | 20 | int a; //used to select the direction based ont what button is pressed |
ale_carb0ni | 2:7fa08670b1fc | 21 | int ntail; //used to increase lenght of the tail |
ale_carb0ni | 2:7fa08670b1fc | 22 | int k; |
ale_carb0ni | 2:7fa08670b1fc | 23 | int rx; |
ale_carb0ni | 2:7fa08670b1fc | 24 | int ry; |
ale_carb0ni | 2:7fa08670b1fc | 25 | char buffer[10]; |
ale_carb0ni | 2:7fa08670b1fc | 26 | int fruitX1; |
ale_carb0ni | 2:7fa08670b1fc | 27 | int fruitY1; |
ale_carb0ni | 2:7fa08670b1fc | 28 | vector <int> x_pos; |
ale_carb0ni | 2:7fa08670b1fc | 29 | vector <int> y_pos; |
ale_carb0ni | 2:7fa08670b1fc | 30 | |
ale_carb0ni | 2:7fa08670b1fc | 31 | public: |
ale_carb0ni | 2:7fa08670b1fc | 32 | |
ale_carb0ni | 2:7fa08670b1fc | 33 | Game(); |
ale_carb0ni | 2:7fa08670b1fc | 34 | |
ale_carb0ni | 2:7fa08670b1fc | 35 | void movement(Gamepad &pad); |
ale_carb0ni | 2:7fa08670b1fc | 36 | bool death(N5110 &lcd,Gamepad &pad); |
ale_carb0ni | 2:7fa08670b1fc | 37 | void draw(N5110 &lcd,Gamepad &pad); |
ale_carb0ni | 2:7fa08670b1fc | 38 | void gameover(N5110 &lcd,Gamepad &pad); |
ale_carb0ni | 2:7fa08670b1fc | 39 | void point(N5110 &lcd,Gamepad &pad); |
ale_carb0ni | 2:7fa08670b1fc | 40 | }; |
ale_carb0ni | 2:7fa08670b1fc | 41 | #endif |