Adam Baker 201166301

Dependencies:   mbed Gamepad N5110

Committer:
adambakerwa
Date:
Wed May 08 22:00:17 2019 +0000
Revision:
43:11c5d098ce9d
Parent:
42:0dad7c359fa5
Child:
44:03059810630d
final level addition

Who changed what in which revision?

UserRevisionLine numberNew contents of line
adambakerwa 25:230e4163cb6b 1 #ifndef BLOCKHEADENGINE_H
adambakerwa 25:230e4163cb6b 2 #define BLOCKHEADENGINE_H
adambakerwa 25:230e4163cb6b 3
adambakerwa 25:230e4163cb6b 4 #include "mbed.h"
adambakerwa 25:230e4163cb6b 5 #include "Gamepad.h"
adambakerwa 25:230e4163cb6b 6 #include "N5110.h"
adambakerwa 38:51ed5820ffe5 7 #include "Blockhead.h"
adambakerwa 25:230e4163cb6b 8 #include "Levels.h"
adambakerwa 25:230e4163cb6b 9 #include "Animation.h"
adambakerwa 25:230e4163cb6b 10
adambakerwa 38:51ed5820ffe5 11 /** BlockheadEngine Class
adambakerwa 41:4b20f909bbcb 12 * @brief Class for running the game
adambakerwa 38:51ed5820ffe5 13 * @author Adam P. Baker
adambakerwa 38:51ed5820ffe5 14 */
adambakerwa 25:230e4163cb6b 15
adambakerwa 25:230e4163cb6b 16 class BlockheadEngine
adambakerwa 25:230e4163cb6b 17 {
adambakerwa 25:230e4163cb6b 18
adambakerwa 25:230e4163cb6b 19 public:
adambakerwa 43:11c5d098ce9d 20 /** Constructor */
adambakerwa 38:51ed5820ffe5 21 BlockheadEngine();
adambakerwa 25:230e4163cb6b 22
adambakerwa 43:11c5d098ce9d 23 /** Deconstructor */
adambakerwa 25:230e4163cb6b 24 ~BlockheadEngine();
adambakerwa 25:230e4163cb6b 25
adambakerwa 43:11c5d098ce9d 26 /** Initialises variables in blockhead class and level class and _pos struct. */
adambakerwa 26:3319ddd5111d 27 void init();
adambakerwa 38:51ed5820ffe5 28
adambakerwa 43:11c5d098ce9d 29 /** Intialises variables in blockhead class and level class and _pos struck (except level number which it keeps the same) */
adambakerwa 31:bf765e3961f1 30 void continueInit();
adambakerwa 38:51ed5820ffe5 31
adambakerwa 43:11c5d098ce9d 32 /** runs the game 'blockhead'
adambakerwa 43:11c5d098ce9d 33 *@param N5110 class which controlls lcd screen
adambakerwa 43:11c5d098ce9d 34 *@param Gamepad class for working with the gamepad
adambakerwa 43:11c5d098ce9d 35 *@returns _gameover (0 when blockhead alive, 1 once died) (int)
adambakerwa 38:51ed5820ffe5 36 */
adambakerwa 25:230e4163cb6b 37 int playgame(N5110 &lcd, Gamepad &pad);
adambakerwa 38:51ed5820ffe5 38
adambakerwa 43:11c5d098ce9d 39 /** sets highscore if new highest level reached
adambakerwa 43:11c5d098ce9d 40 *@retunrs _highscore (int)
adambakerwa 38:51ed5820ffe5 41 */
adambakerwa 36:6f452777b9ce 42 int highscore();
adambakerwa 36:6f452777b9ce 43
adambakerwa 25:230e4163cb6b 44 private:
adambakerwa 25:230e4163cb6b 45
adambakerwa 42:0dad7c359fa5 46 Blockhead _blockhead; //blockhead class
adambakerwa 42:0dad7c359fa5 47 Levels _lev; //levels class
adambakerwa 25:230e4163cb6b 48
adambakerwa 42:0dad7c359fa5 49 Pos _pos; //_pos struct
adambakerwa 25:230e4163cb6b 50
adambakerwa 25:230e4163cb6b 51
adambakerwa 42:0dad7c359fa5 52 int _gameover; /**< _gameover flag (0 when alive, 1 onnce died) */
adambakerwa 42:0dad7c359fa5 53 int _level; /**< what level blockhead is on */
adambakerwa 42:0dad7c359fa5 54 int _highscore; /**< highest level reached */
adambakerwa 25:230e4163cb6b 55 };
adambakerwa 25:230e4163cb6b 56
adambakerwa 25:230e4163cb6b 57 #endif