Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Game.h
00001 #include "mbed.h" 00002 #include "N5110.h" 00003 #include "Gamepad.h" 00004 00005 00006 /** The Game class 00007 * @brief the functions of game roles 00008 * @author ZIYI CHEN 00009 * @date May 2019 00010 */ 00011 00012 class Game 00013 { 00014 public: 00015 00016 /**Constructor*/ 00017 Game(); 00018 00019 /**Destructor*/ 00020 ~Game(); 00021 00022 /** init function 00023 * @param inital starting coordinate of snake head. 00024 */ 00025 void init(int x, int y); 00026 /** Updates coordinate of snake 00027 * @param the joystick'direction 00028 */ 00029 void update(Direction d); 00030 00031 /** Gets snake length 00032 * @return the value of snake length 00033 */ 00034 int getLength(); 00035 00036 /** add snake length by 1 */ 00037 void grow(); 00038 00039 00040 /** Gets x coordinate of the snake 00041 * @param the position of snake in x coorinate 00042 * @return value of _x[now] 00043 */ 00044 int xcoordinate(int now); 00045 00046 /** Gets y coordinate of the snake 00047 * @param the position of snake in y coorinate 00048 * @return value of _y[now] 00049 */ 00050 int ycoordinate(int now); 00051 /** the previous direction of snake*/ 00052 char Previous_direction; 00053 00054 00055 int _length; 00056 00057 00058 00059 /**the _y and _y array*/ 00060 int _x[4032]; 00061 int _y[4032]; 00062 00063 00064 00065 };
Generated on Fri Jul 15 2022 14:43:24 by
1.7.2