ZIYI CHEN ml17z4c 201214999

Dependencies:   mbed

Revision:
13:08bdb4cffacd
Child:
14:60c31d25d895
diff -r 1106cd853157 -r 08bdb4cffacd Game/Game.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Game/Game.h	Thu May 09 14:36:47 2019 +0000
@@ -0,0 +1,65 @@
+#include "mbed.h"
+#include "N5110.h"
+#include "Gamepad.h"
+
+
+/** The Game class
+* @brief the functions of game roles
+* @author ZIYI CHEN
+* @date may 2019
+*/
+
+class Game
+{
+public:
+
+    /**Constructor*/
+    Game();
+
+    /**Destructor*/
+    ~Game();
+
+ /** init function
+    * @param inital starting coordinate of snake head.
+    */
+    void init(int x, int y);
+    /** Updates coordinate of snake
+    * @param the joystick'direction
+    */
+    void update(Direction d);
+    
+    /** Gets snake length
+    * @return the value of snake length
+    */
+    int getLength();
+    
+     /** add snake length by 1 */
+    void grow();
+    
+        
+    /** Gets x coordinate of the snake
+    * @param the position of snake in x coorinate
+    * @return value of _x[now]
+    */
+    int xcoordinate(int now);
+    
+    /** Gets y coordinate of the snake
+    * @param the position of snake in y coorinate
+    * @return value of _y[now]
+    */
+    int ycoordinate(int now);
+    /**  the previous direction of snake*/
+    char Previous_direction;
+    
+
+    int _length;
+
+
+
+    /**the _y and _y array*/
+    int _x[4032];
+    int _y[4032];
+
+
+
+};