Owen Cavender 201159294

Dependencies:   mbed Gamepad2

Committer:
el17oc
Date:
Wed May 27 10:27:34 2020 +0000
Revision:
5:d716013c6a18
Parent:
2:44e4a6ecdbef
Child:
6:bf90044188d0
not final

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17oc 1:897160a1a3ae 1
el17oc 1:897160a1a3ae 2 #ifndef SNAKE_H
el17oc 1:897160a1a3ae 3 #define SNAKE_H
el17oc 1:897160a1a3ae 4
el17oc 1:897160a1a3ae 5 #include "mbed.h"
el17oc 1:897160a1a3ae 6 #include "N5110.h"
el17oc 1:897160a1a3ae 7 #include "Gamepad.h"
el17oc 1:897160a1a3ae 8 #include "GameEngine.h"
el17oc 1:897160a1a3ae 9
el17oc 1:897160a1a3ae 10
el17oc 1:897160a1a3ae 11 class Snake
el17oc 1:897160a1a3ae 12 {
el17oc 1:897160a1a3ae 13
el17oc 1:897160a1a3ae 14
el17oc 1:897160a1a3ae 15 public:
el17oc 1:897160a1a3ae 16 Snake();
el17oc 1:897160a1a3ae 17 ~Snake();
el17oc 1:897160a1a3ae 18
el17oc 1:897160a1a3ae 19 enum Directions {
el17oc 1:897160a1a3ae 20 up,
el17oc 1:897160a1a3ae 21 down,
el17oc 1:897160a1a3ae 22 left,
el17oc 1:897160a1a3ae 23 right,
el17oc 1:897160a1a3ae 24 null
el17oc 1:897160a1a3ae 25 };
el17oc 1:897160a1a3ae 26
el17oc 5:d716013c6a18 27 void init(GameEngine &engine);
el17oc 1:897160a1a3ae 28 int set_direction(Gamepad &pad);
el17oc 1:897160a1a3ae 29 //Directions get_direction();
el17oc 5:d716013c6a18 30 void move_snakebody(GameEngine &engine, N5110 &lcd);
el17oc 1:897160a1a3ae 31 void gameover_true(N5110 &lcd);
el17oc 5:d716013c6a18 32 void check_scored(N5110 &lcd, Gamepad &pad, GameEngine &engine);
el17oc 1:897160a1a3ae 33 void check_wall_collisions();
el17oc 1:897160a1a3ae 34 // void render(N5110 &lcd);
el17oc 1:897160a1a3ae 35 void clear_applepos(N5110 &lcd);
el17oc 5:d716013c6a18 36 // void draw_snake(Vector2D &_snakebody, N5110 &lcd);
el17oc 1:897160a1a3ae 37
el17oc 1:897160a1a3ae 38
el17oc 1:897160a1a3ae 39
el17oc 1:897160a1a3ae 40 private:
el17oc 1:897160a1a3ae 41
el17oc 1:897160a1a3ae 42 bool _gameover;
el17oc 1:897160a1a3ae 43 Directions _direction;
el17oc 1:897160a1a3ae 44 int _length;
el17oc 1:897160a1a3ae 45 int _score;
el17oc 5:d716013c6a18 46 Vector2D *_snakebody;
el17oc 5:d716013c6a18 47 Vector2D S0;
el17oc 5:d716013c6a18 48 Vector2D S1;
el17oc 5:d716013c6a18 49
el17oc 1:897160a1a3ae 50
el17oc 1:897160a1a3ae 51 };
el17oc 1:897160a1a3ae 52
el17oc 1:897160a1a3ae 53
el17oc 1:897160a1a3ae 54 #endif