Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: GameObjects/Snake/Snake.h
- Revision:
- 51:387249f9b333
- Parent:
- 41:4edac50f010d
- Child:
- 53:527cf297b088
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GameObjects/Snake/Snake.h Fri Apr 26 18:30:25 2019 +0000 @@ -0,0 +1,59 @@ +#ifndef Snake_H +#define Snake_H + +#include "mbed.h" +#include "N5110.h" +#include "Gamepad.h" + + +class Snake +{ + public: + + + Snake(); + ~Snake(); + + /** Initialise Snake + * + * This function initalises the Snake library. + */ + void init(); + + /** Draw + * + * This function draws the Snake sprite onto the screen at the specified coordinates. + */ + void draw(Gamepad &pad, N5110 &lcd, int length, int level); + + /** Update + * + * This function updates the Snake sprite position on screen. + */ + void update(Direction d, int* b); + + /** Get Position + * + * This function obtains the coordinate of the top-left pixel in the Snake sprite. + */ + Vector2D get_pos(); + Vector2D get_pos_before1(); + Vector2D get_pos_before2(); + Vector2D get_pos_before3(); + Vector2D get_pos_before4(); + Vector2D get_pos_before5(); + Vector2D get_pos_before6(); + Vector2D get_pos_before7(); + Vector2D get_pos_before8(); + Vector2D get_pos_before9(); + int m; + int b[15]; //each element in this array represents the beed number in the snake. + + private: + int _speed; //this is the speed of the snake flowing in the x axis. + int _x[15]; //each element in this array represents the x position of each beed in the snake. + int _y[15]; //each element in this array represents the y position of each beed in the snake. + int _length; + +}; +#endif \ No newline at end of file