ZIYI CHEN ml17z4c 201214999

Dependencies:   mbed

Committer:
ziyi11
Date:
Wed May 08 20:48:33 2019 +0000
Revision:
9:a8b2086a46e5
Parent:
8:52e0506e98b8
try1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ziyi11 8:52e0506e98b8 1 #include "mbed.h"
ziyi11 8:52e0506e98b8 2 #include "N5110.h"
ziyi11 8:52e0506e98b8 3 #include "Gamepad.h"
ziyi11 8:52e0506e98b8 4
ziyi11 8:52e0506e98b8 5
ziyi11 9:a8b2086a46e5 6 /** The Game class
ziyi11 9:a8b2086a46e5 7 * @brief the functions of game roles
ziyi11 9:a8b2086a46e5 8 * @author ZIYI CHEN
ziyi11 9:a8b2086a46e5 9 * @date may 2019
ziyi11 9:a8b2086a46e5 10 */
ziyi11 8:52e0506e98b8 11
ziyi11 9:a8b2086a46e5 12 class Game
ziyi11 8:52e0506e98b8 13 {
ziyi11 8:52e0506e98b8 14 public:
ziyi11 9:a8b2086a46e5 15
ziyi11 9:a8b2086a46e5 16 /**Constructor*/
ziyi11 9:a8b2086a46e5 17 Game();
ziyi11 9:a8b2086a46e5 18
ziyi11 9:a8b2086a46e5 19 /**Destructor*/
ziyi11 9:a8b2086a46e5 20 ~Game();
ziyi11 9:a8b2086a46e5 21
ziyi11 9:a8b2086a46e5 22 /** init function
ziyi11 9:a8b2086a46e5 23 * @param inital starting coordinate of snake head.
ziyi11 9:a8b2086a46e5 24 */
ziyi11 8:52e0506e98b8 25 void init(int x, int y);
ziyi11 9:a8b2086a46e5 26 /** Updates coordinate of snake
ziyi11 9:a8b2086a46e5 27 * @param the joystick'direction
ziyi11 9:a8b2086a46e5 28 */
ziyi11 8:52e0506e98b8 29 void update(Direction d);
ziyi11 9:a8b2086a46e5 30
ziyi11 9:a8b2086a46e5 31 /** Gets snake length
ziyi11 9:a8b2086a46e5 32 * @return the value of snake length
ziyi11 9:a8b2086a46e5 33 */
ziyi11 9:a8b2086a46e5 34 int getLength();
ziyi11 9:a8b2086a46e5 35
ziyi11 9:a8b2086a46e5 36 /** add snake length by 1 */
ziyi11 8:52e0506e98b8 37 void grow();
ziyi11 9:a8b2086a46e5 38
ziyi11 9:a8b2086a46e5 39
ziyi11 9:a8b2086a46e5 40 /** Gets x coordinate of the snake
ziyi11 9:a8b2086a46e5 41 * @param the position of snake in x coorinate
ziyi11 9:a8b2086a46e5 42 * @return value of _x[now]
ziyi11 9:a8b2086a46e5 43 */
ziyi11 9:a8b2086a46e5 44 int xcoordinate(int now);
ziyi11 9:a8b2086a46e5 45
ziyi11 9:a8b2086a46e5 46 /** Gets y coordinate of the snake
ziyi11 9:a8b2086a46e5 47 * @param the position of snake in y coorinate
ziyi11 9:a8b2086a46e5 48 * @return value of _y[now]
ziyi11 9:a8b2086a46e5 49 */
ziyi11 9:a8b2086a46e5 50 int ycoordinate(int now);
ziyi11 9:a8b2086a46e5 51 /** the previous direction of snake*/
ziyi11 9:a8b2086a46e5 52 char Previous_direction;
ziyi11 9:a8b2086a46e5 53
ziyi11 8:52e0506e98b8 54
ziyi11 9:a8b2086a46e5 55 int _length;
ziyi11 8:52e0506e98b8 56
ziyi11 8:52e0506e98b8 57
ziyi11 9:a8b2086a46e5 58
ziyi11 9:a8b2086a46e5 59 /**the _y and _y array*/
ziyi11 9:a8b2086a46e5 60 int _x[4032];
ziyi11 9:a8b2086a46e5 61 int _y[4032];
ziyi11 9:a8b2086a46e5 62
ziyi11 8:52e0506e98b8 63
ziyi11 8:52e0506e98b8 64
ziyi11 8:52e0506e98b8 65 };