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
- Committer:
- ale_carb0ni
- Date:
- 2020-05-26
- Revision:
- 7:8d381315f72c
- Parent:
- 6:a2c72def99f9
File content as of revision 7:8d381315f72c:
#ifndef GAME_H #define GAME_H #include "mbed.h" #include "Gamepad.h" #include "N5110.h" #include <vector> #include "Menu.h" /** Game Class * @brief controls the functioning of the game * @author Alessandro Carboni * @date Apr, 2020 */ class Game { private: int x; int y; int fruitX [16]; int fruitY [9]; int score; int a; //used to select the direction based ont what button is pressed int ntail; //used to increase lenght of the tail int k; int rx; int ry; char buffer[10]; int fruitX1; int fruitY1; vector <int> x_pos; vector <int> y_pos; public: /**Constructor*/ Game();//initialises the game /**Reguates the diretion of movement of the snake * @param Gamepad class object */ void movement(Gamepad &pad); /**Regulates the way the snake moves */ void updating_position(); /**Get value of which button is pressed *@ param N5110 class object *@ param Gamepad class object * @return death value (0,1,2) */ int death(N5110 &lcd,Gamepad &pad); /**Draws the game field, the snake and the fruit *@ param N5110 class object *@ param Gamepad class object */ void draw(N5110 &lcd,Gamepad &pad); /**Executes what happens when you die *@ param N5110 class object *@ param Gamepad class object */ void gameover(N5110 &lcd,Gamepad &pad); /**Increases your points and your lenght when you score *@ param N5110 class object *@ param Gamepad class object */ void point(N5110 &lcd,Gamepad &pad); }; #endif