Simple fish eat program

Dependencies:   mbed mbed-rtos N5110 ShiftReg Tone

Committer:
el18a2k
Date:
Mon Aug 02 14:35:02 2021 +0000
Revision:
14:f1552b691274
Parent:
13:183bd19f3d7d
final

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el18a2k 14:f1552b691274 1 /* Fish Eat Game v2.0
el18a2k 14:f1552b691274 2 * Author: Andrew Knowles
el18a2k 14:f1552b691274 3 * Date: 21/04/2021
el18a2k 14:f1552b691274 4 * Note: See hearder files for additional recognistion */
el18a2k 14:f1552b691274 5
el18a2k 10:e221bd1ce3ec 6 #ifndef GAME_H
el18a2k 10:e221bd1ce3ec 7 #define GAME_H
el18a2k 10:e221bd1ce3ec 8
el18a2k 10:e221bd1ce3ec 9 #include "mbed.h"
el18a2k 10:e221bd1ce3ec 10 #include "N5110.h"
el18a2k 12:20ac766b3175 11 #include "ShiftReg.h"
el18a2k 10:e221bd1ce3ec 12 #include "Joystick.h"
el18a2k 10:e221bd1ce3ec 13
el18a2k 10:e221bd1ce3ec 14 #include "Graphics.h"
el18a2k 12:20ac766b3175 15 #include "Sound.h"
el18a2k 10:e221bd1ce3ec 16
el18a2k 10:e221bd1ce3ec 17 struct DIRECTION {
el18a2k 10:e221bd1ce3ec 18 Direction joy;
el18a2k 10:e221bd1ce3ec 19 };
el18a2k 10:e221bd1ce3ec 20
el18a2k 10:e221bd1ce3ec 21 class Game {
el18a2k 10:e221bd1ce3ec 22
el18a2k 10:e221bd1ce3ec 23 public:
el18a2k 10:e221bd1ce3ec 24
el18a2k 10:e221bd1ce3ec 25 //plays the game
el18a2k 13:183bd19f3d7d 26 void gamePlay(N5110 &lcd, DIRECTION direction);
el18a2k 10:e221bd1ce3ec 27
el18a2k 10:e221bd1ce3ec 28 //draws the playing area
el18a2k 10:e221bd1ce3ec 29 void init(N5110 &lcd, int x, int y, int Fish_size);
el18a2k 10:e221bd1ce3ec 30
el18a2k 10:e221bd1ce3ec 31 //draws fish
el18a2k 10:e221bd1ce3ec 32 void drawFish(N5110 &lcd);
el18a2k 10:e221bd1ce3ec 33
el18a2k 10:e221bd1ce3ec 34 //updates fish position
el18a2k 10:e221bd1ce3ec 35 void fishPos(DIRECTION direction);
el18a2k 10:e221bd1ce3ec 36
el18a2k 10:e221bd1ce3ec 37 //Keeps score
el18a2k 10:e221bd1ce3ec 38 int Score(N5110 &lcd);
el18a2k 10:e221bd1ce3ec 39
el18a2k 10:e221bd1ce3ec 40 //keeps track of lives
el18a2k 10:e221bd1ce3ec 41 int Lives();
el18a2k 10:e221bd1ce3ec 42
el18a2k 10:e221bd1ce3ec 43 //check for collision with other fish
el18a2k 13:183bd19f3d7d 44 void Collision();
el18a2k 10:e221bd1ce3ec 45
el18a2k 10:e221bd1ce3ec 46 //generate enemy fish
el18a2k 10:e221bd1ce3ec 47 void enemyFish(N5110 &lcd);
el18a2k 10:e221bd1ce3ec 48
el18a2k 10:e221bd1ce3ec 49 private:
el18a2k 10:e221bd1ce3ec 50 int _x;
el18a2k 10:e221bd1ce3ec 51 int _y;
el18a2k 10:e221bd1ce3ec 52 int X;
el18a2k 10:e221bd1ce3ec 53 int Y;
el18a2k 11:7c1e2a9303d3 54 int i;
el18a2k 11:7c1e2a9303d3 55 int colour;
el18a2k 10:e221bd1ce3ec 56 int lives;
el18a2k 10:e221bd1ce3ec 57 int check_width;
el18a2k 10:e221bd1ce3ec 58 int rect_width;
el18a2k 10:e221bd1ce3ec 59 int barIncrement;
el18a2k 10:e221bd1ce3ec 60 int FISH_SIZE;
el18a2k 10:e221bd1ce3ec 61 int FISH_HEIGHT;
el18a2k 10:e221bd1ce3ec 62 int FISH_WIDTH;
el18a2k 10:e221bd1ce3ec 63 int E_FISH_HEIGHT;
el18a2k 10:e221bd1ce3ec 64 int E_FISH_WIDTH;
el18a2k 10:e221bd1ce3ec 65 int E_FISH;
el18a2k 10:e221bd1ce3ec 66 int collision;
el18a2k 10:e221bd1ce3ec 67 int x_bound;
el18a2k 10:e221bd1ce3ec 68 int y_bound;
el18a2k 12:20ac766b3175 69 int check_score;
el18a2k 12:20ac766b3175 70 int SCORE;
el18a2k 12:20ac766b3175 71 int s_length;
el18a2k 10:e221bd1ce3ec 72 float centre_xpos;
el18a2k 10:e221bd1ce3ec 73 float centre_ypos;
el18a2k 12:20ac766b3175 74 float CENTRE_X;
el18a2k 12:20ac766b3175 75 float CENTRE_Y;
el18a2k 12:20ac766b3175 76 float E_CENTRE_X;
el18a2k 12:20ac766b3175 77 float E_CENTRE_Y;
el18a2k 10:e221bd1ce3ec 78 char _score[14];
el18a2k 10:e221bd1ce3ec 79
el18a2k 10:e221bd1ce3ec 80 };
el18a2k 10:e221bd1ce3ec 81
el18a2k 10:e221bd1ce3ec 82 #endif