ELEC2645 (2018/19) / Mbed 2 deprecated ml17z4c_attempt2

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Eng.h Source File

Eng.h

00001 #include "mbed.h"
00002 #include "N5110.h"
00003 #include "Gamepad.h"
00004 #include "Game.h"
00005 #include "Food.h"
00006 
00007 
00008 /** The Game class
00009 * @brief Handles all failure states and game drawing
00010 * @author ZIYI CHEN
00011 * @date May 2019
00012 */
00013 class Eng
00014 {
00015 
00016 public:
00017 
00018     /**Constructor*/
00019     Eng();
00020     
00021     /**Destructor*/
00022     ~Eng();
00023     
00024     /** The init function   */
00025     void init();
00026     
00027     /**load map function
00028     *@param drow map on lcd
00029     */
00030 
00031     void userinput(Gamepad &pad);
00032     
00033    /**draw the game picture
00034     *@@param use LCD to draw
00035     */
00036     void draw(N5110 &lcd);
00037     
00038     /**draw the game over picture
00039     *@@param give score and wait 5 seconds to play again
00040     */
00041     void score(N5110 &lcd);
00042     /** Updates game state
00043     * @param check and update the game state
00044     */
00045     void update(Gamepad &pad);
00046 
00047 
00048 
00049 
00050    
00051   /** Gets score
00052     * @return score
00053     */
00054  
00055     float getScore();
00056     
00057     /** Gets gameover
00058     * @return ifgameOver
00059     */
00060     bool getGameOver();
00061 
00062 
00063 
00064 
00065   /** Gets  checkFood
00066     * @return value of checkFood
00067     */
00068     bool checkFood();
00069     /** extand the snake function
00070     * @return snake grow 
00071     */
00072     void growSnake();
00073      /** check weather the snake dead
00074     * @return snake dead game end
00075     */
00076     void dead();
00077     
00078     /** Gets  _gameOver
00079     * @return value of _gameOver
00080     */
00081    bool _gameOver;
00082    
00083     /**some variables used to save score direction, map, food and others*/
00084     int _score;
00085     Direction _d;
00086     int snake1[84][48];
00087     Game dSnake; 
00088     Food _noodles; 
00089 
00090 };