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@6:a2c72def99f9, 2020-05-26 (annotated)
- Committer:
- ale_carb0ni
- Date:
- Tue May 26 18:14:03 2020 +0000
- Revision:
- 6:a2c72def99f9
- Parent:
- 4:17d5b53b8815
- Child:
- 7:8d381315f72c
commented version;
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 | 6:a2c72def99f9 | 10 | /** Game Class |
ale_carb0ni | 6:a2c72def99f9 | 11 | * @brief controls the functioning of the game |
ale_carb0ni | 6:a2c72def99f9 | 12 | * @author Alessandro Carboni |
ale_carb0ni | 6:a2c72def99f9 | 13 | * @date Apr, 2020 |
ale_carb0ni | 6:a2c72def99f9 | 14 | */ |
ale_carb0ni | 6:a2c72def99f9 | 15 | |
ale_carb0ni | 2:7fa08670b1fc | 16 | class Game |
ale_carb0ni | 2:7fa08670b1fc | 17 | { |
ale_carb0ni | 2:7fa08670b1fc | 18 | |
ale_carb0ni | 2:7fa08670b1fc | 19 | private: |
ale_carb0ni | 2:7fa08670b1fc | 20 | |
ale_carb0ni | 2:7fa08670b1fc | 21 | int x; |
ale_carb0ni | 2:7fa08670b1fc | 22 | int y; |
ale_carb0ni | 2:7fa08670b1fc | 23 | int fruitX [16]; |
ale_carb0ni | 2:7fa08670b1fc | 24 | int fruitY [9]; |
ale_carb0ni | 2:7fa08670b1fc | 25 | int score; |
ale_carb0ni | 2:7fa08670b1fc | 26 | int a; //used to select the direction based ont what button is pressed |
ale_carb0ni | 2:7fa08670b1fc | 27 | int ntail; //used to increase lenght of the tail |
ale_carb0ni | 2:7fa08670b1fc | 28 | int k; |
ale_carb0ni | 2:7fa08670b1fc | 29 | int rx; |
ale_carb0ni | 2:7fa08670b1fc | 30 | int ry; |
ale_carb0ni | 2:7fa08670b1fc | 31 | char buffer[10]; |
ale_carb0ni | 2:7fa08670b1fc | 32 | int fruitX1; |
ale_carb0ni | 2:7fa08670b1fc | 33 | int fruitY1; |
ale_carb0ni | 2:7fa08670b1fc | 34 | vector <int> x_pos; |
ale_carb0ni | 2:7fa08670b1fc | 35 | vector <int> y_pos; |
ale_carb0ni | 2:7fa08670b1fc | 36 | |
ale_carb0ni | 2:7fa08670b1fc | 37 | public: |
ale_carb0ni | 2:7fa08670b1fc | 38 | |
ale_carb0ni | 2:7fa08670b1fc | 39 | Game(); |
ale_carb0ni | 2:7fa08670b1fc | 40 | |
ale_carb0ni | 2:7fa08670b1fc | 41 | void movement(Gamepad &pad); |
ale_carb0ni | 4:17d5b53b8815 | 42 | void updating_position(); |
ale_carb0ni | 3:c61d0c70eda4 | 43 | int death(N5110 &lcd,Gamepad &pad); |
ale_carb0ni | 2:7fa08670b1fc | 44 | void draw(N5110 &lcd,Gamepad &pad); |
ale_carb0ni | 2:7fa08670b1fc | 45 | void gameover(N5110 &lcd,Gamepad &pad); |
ale_carb0ni | 2:7fa08670b1fc | 46 | void point(N5110 &lcd,Gamepad &pad); |
ale_carb0ni | 2:7fa08670b1fc | 47 | }; |
ale_carb0ni | 4:17d5b53b8815 | 48 | |
ale_carb0ni | 2:7fa08670b1fc | 49 | #endif |