Balint Bogdan 2645 project, 200966741

Dependents:   2645Game_el15bb

Committer:
Nefos
Date:
Fri May 05 15:06:54 2017 +0000
Revision:
6:cc8d2088f490
Parent:
5:449858a54971
Child:
7:a2f426a37e60
working code, needs formatting;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Nefos 0:2eb4d7e86e2f 1 #ifndef SNAKE_H
Nefos 0:2eb4d7e86e2f 2 #define SNAKE_H
Nefos 0:2eb4d7e86e2f 3
Nefos 0:2eb4d7e86e2f 4
Nefos 0:2eb4d7e86e2f 5 #include "mbed.h"
Nefos 0:2eb4d7e86e2f 6 #include "N5110.h"
Nefos 0:2eb4d7e86e2f 7 #include "Gamepad.h"
Nefos 2:5e04e34a3b66 8 #include "Food.h"
Nefos 0:2eb4d7e86e2f 9
Nefos 6:cc8d2088f490 10 /************************Structs************************/
Nefos 0:2eb4d7e86e2f 11 struct snakePart{
Nefos 0:2eb4d7e86e2f 12 char _x[4000];
Nefos 0:2eb4d7e86e2f 13 char _y[4000];
Nefos 0:2eb4d7e86e2f 14 char _dir[4000];
Nefos 0:2eb4d7e86e2f 15
Nefos 0:2eb4d7e86e2f 16 };
Nefos 6:cc8d2088f490 17
Nefos 6:cc8d2088f490 18 /************************Class Def************************/
Nefos 0:2eb4d7e86e2f 19
Nefos 6:cc8d2088f490 20 class Snake{
Nefos 6:cc8d2088f490 21
Nefos 6:cc8d2088f490 22 /************************Public Vars************************/
Nefos 0:2eb4d7e86e2f 23 public:
Nefos 0:2eb4d7e86e2f 24
Nefos 0:2eb4d7e86e2f 25 Snake();
Nefos 0:2eb4d7e86e2f 26 ~Snake();
Nefos 3:b24ef00836c5 27 void init(int x, int y, int lenght,int _live);
Nefos 0:2eb4d7e86e2f 28 void draw(N5110 &lcd);
Nefos 0:2eb4d7e86e2f 29 void update(Gamepad &pad);
Nefos 2:5e04e34a3b66 30 void deadSnake(N5110 &lcd);
Nefos 6:cc8d2088f490 31 void addPoint();
Nefos 2:5e04e34a3b66 32 void checkWallCollision(N5110 &lcd);
Nefos 5:449858a54971 33 void checkTailCollision(N5110 &lcd);
Nefos 0:2eb4d7e86e2f 34 int _length;
Nefos 2:5e04e34a3b66 35 int live;
Nefos 4:c74ec3f409f9 36 float waitTime;
Nefos 4:c74ec3f409f9 37 float waitCount;
Nefos 3:b24ef00836c5 38
Nefos 0:2eb4d7e86e2f 39
Nefos 1:93a4cb86f100 40
Nefos 0:2eb4d7e86e2f 41
Nefos 6:cc8d2088f490 42 /************************Private Vars************************/
Nefos 0:2eb4d7e86e2f 43 private:
Nefos 6:cc8d2088f490 44
Nefos 0:2eb4d7e86e2f 45
Nefos 0:2eb4d7e86e2f 46 int _speed;
Nefos 0:2eb4d7e86e2f 47 int _direction;
Nefos 1:93a4cb86f100 48 int startx;
Nefos 1:93a4cb86f100 49 int starty;
Nefos 3:b24ef00836c5 50 int startl;
Nefos 0:2eb4d7e86e2f 51 int x;
Nefos 0:2eb4d7e86e2f 52 Direction d;
Nefos 3:b24ef00836c5 53 Food _food;
Nefos 0:2eb4d7e86e2f 54
Nefos 0:2eb4d7e86e2f 55
Nefos 6:cc8d2088f490 56 };
Nefos 0:2eb4d7e86e2f 57
Nefos 0:2eb4d7e86e2f 58 #endif