ELEC2645 (2018/19) / Mbed 2 deprecated el17apb

Dependencies:   mbed Gamepad N5110

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BlockheadEngine.h Source File

BlockheadEngine.h

00001 #ifndef BLOCKHEADENGINE_H
00002 #define BLOCKHEADENGINE_H
00003 
00004 #include "mbed.h"
00005 #include "Gamepad.h"
00006 #include "N5110.h"
00007 #include "Blockhead.h"
00008 #include "Levels.h"
00009 #include "Animation.h"
00010 
00011 /** BlockheadEngine Class
00012  * @brief Class for running the game
00013  * @author Adam P. Baker
00014  * @date 9 May 2019
00015  */
00016 class BlockheadEngine
00017 {
00018 public:
00019     /** Constructor */
00020     BlockheadEngine();
00021     
00022     /** Deconstructor */
00023     ~BlockheadEngine();
00024     
00025     /** Initialises variables in blockhead class and level class and _pos struct. */
00026     void init();
00027     
00028     /** Intialises variables in blockhead class and level class and _pos struck (except level number which it keeps the same) */
00029     void continue_init();
00030     
00031     /** runs the game 'blockhead'
00032     *@param N5110 class which controlls lcd screen
00033     *@param Gamepad class for working with the gamepad 
00034     *@returns _gameover (0 when blockhead alive, 1 once died) (int)
00035     */
00036     int playgame(N5110 &lcd, Gamepad &pad);
00037     
00038     /** sets highscore if new highest level reached
00039     *@returns _highscore (int)
00040     */
00041     int highscore();
00042     
00043 private:
00044 
00045     Blockhead _blockhead;       //blockhead class 
00046     Levels _lev;                //levels class 
00047     
00048     Pos _pos;                   //_pos struct 
00049 
00050 
00051     int _gameover;              /**< _gameover flag (0 when alive, 1 onnce died) */
00052     int _level;                 /**< what level blockhead is on */
00053     int _highscore;             /**< highest level reached */
00054 };
00055 
00056 #endif