ELEC2645 (2019/20)
/
ELEC2645_Project_el17oc1
Owen Cavender 201159294
Diff: snake.h
- Revision:
- 1:897160a1a3ae
- Child:
- 2:44e4a6ecdbef
diff -r b7f1f47bb26a -r 897160a1a3ae snake.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/snake.h Tue May 26 12:17:59 2020 +0000 @@ -0,0 +1,52 @@ + +#ifndef SNAKE_H +#define SNAKE_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" +#include "GameEngine.h" + + +class Snake +{ + + +public: + Snake(); + ~Snake(); + + enum Directions { + up, + down, + left, + right, + null + }; + + void init(); + int set_direction(Gamepad &pad); + //Directions get_direction(); + void move_and_draw_snake(N5110 &lcd); + void gameover_true(N5110 &lcd); + void check_if_scored(N5110 &lcd, Gamepad &pad); + void check_wall_collisions(); + // void render(N5110 &lcd); + void clear_applepos(N5110 &lcd); + + + + +private: + + bool _gameover; + Directions _direction; + int _length; + int _score; + GameEngine _engine; + + +}; + + +#endif \ No newline at end of file