ZIYI CHEN ml17z4c 201214999

Dependencies:   mbed

Revision:
9:a8b2086a46e5
Parent:
8:52e0506e98b8
diff -r 52e0506e98b8 -r a8b2086a46e5 Game/Game.h
--- a/Game/Game.h	Mon May 06 00:06:15 2019 +0000
+++ b/Game/Game.h	Wed May 08 20:48:33 2019 +0000
@@ -3,30 +3,63 @@
 #include "Gamepad.h"
 
 
-
+/** The Game class
+* @brief the functions of game roles
+* @author ZIYI CHEN
+* @date may 2019
+*/
 
-class Snake
+class Game
 {
 public:
- 
-    
-    Snake();
-    ~Snake();
+
+    /**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);
-    int getLength();    
-    int getX(int head);
-    int getY(int head);
+    
+    /** 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;
+    
 
-private:
+    int _length;
 
 
-    int _x[484];      
-    int _y[484];
-    int _length;
-    int _speed;
-    char _oldDirection;
+
+    /**the _y and _y array*/
+    int _x[4032];
+    int _y[4032];
+
 
 
 };