Simple fish eat program
Dependencies: mbed mbed-rtos N5110 ShiftReg Tone
Diff: classes/Game.h
- Revision:
- 10:e221bd1ce3ec
- Parent:
- 9:d52c4df02493
- Child:
- 11:7c1e2a9303d3
--- a/classes/Game.h Tue Apr 20 15:08:37 2021 +0000 +++ b/classes/Game.h Tue Apr 20 15:35:00 2021 +0000 @@ -0,0 +1,76 @@ +#ifndef GAME_H +#define GAME_H + +#include "mbed.h" +#include "N5110.h" +#include "Joystick.h" +#include "ShiftReg.h" + +#include "Graphics.h" + +struct DIRECTION { + Direction joy; +}; + +class Game { + +public: + + //plays the game + void gamePlay(N5110 &lcd, DIRECTION direction); + + //draws the playing area + void init(N5110 &lcd, int x, int y, int Fish_size); + + //draws fish + void drawFish(N5110 &lcd); + + //updates fish position + void fishPos(DIRECTION direction); + + //Keeps score + int Score(N5110 &lcd); + + //keeps track of lives + int Lives(); + + //check for collision with other fish + int Collision(); + + //generate enemy fish + void enemyFish(N5110 &lcd); + +private: + int _x; + int _y; + int X; + int Y; + int lives; + int check_width; + int rect_width; + int barIncrement; + int FISH_SIZE; + int FISH_HEIGHT; + int FISH_WIDTH; + float CENTRE_X; + float CENTRE_Y; + int E_FISH_HEIGHT; + int E_FISH_WIDTH; + int E_FISH; + float E_CENTRE_X; + float E_CENTRE_Y; + int collision; + int x_bound; + int y_bound; + + float centre_xpos; + float centre_ypos; + + int check_score; + int SCORE; + char _score[14]; + int s_length; + +}; + +#endif \ No newline at end of file