![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Adam Baker 201166301
Dependencies: mbed Gamepad N5110
BlockheadEngine/BlockheadEngine.h@52:beeffd296ea3, 2019-05-09 (annotated)
- Committer:
- adambakerwa
- Date:
- Thu May 09 12:19:36 2019 +0000
- Revision:
- 52:beeffd296ea3
- Parent:
- 46:69d2d87f78a0
Who changed what in which revision?
User | Revision | Line number | New 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 | 44:03059810630d | 14 | * @date 9 May 2019 |
adambakerwa | 38:51ed5820ffe5 | 15 | */ |
adambakerwa | 25:230e4163cb6b | 16 | class BlockheadEngine |
adambakerwa | 25:230e4163cb6b | 17 | { |
adambakerwa | 25:230e4163cb6b | 18 | public: |
adambakerwa | 43:11c5d098ce9d | 19 | /** Constructor */ |
adambakerwa | 38:51ed5820ffe5 | 20 | BlockheadEngine(); |
adambakerwa | 25:230e4163cb6b | 21 | |
adambakerwa | 43:11c5d098ce9d | 22 | /** Deconstructor */ |
adambakerwa | 25:230e4163cb6b | 23 | ~BlockheadEngine(); |
adambakerwa | 25:230e4163cb6b | 24 | |
adambakerwa | 43:11c5d098ce9d | 25 | /** Initialises variables in blockhead class and level class and _pos struct. */ |
adambakerwa | 26:3319ddd5111d | 26 | void init(); |
adambakerwa | 38:51ed5820ffe5 | 27 | |
adambakerwa | 43:11c5d098ce9d | 28 | /** Intialises variables in blockhead class and level class and _pos struck (except level number which it keeps the same) */ |
adambakerwa | 44:03059810630d | 29 | void continue_init(); |
adambakerwa | 38:51ed5820ffe5 | 30 | |
adambakerwa | 43:11c5d098ce9d | 31 | /** runs the game 'blockhead' |
adambakerwa | 43:11c5d098ce9d | 32 | *@param N5110 class which controlls lcd screen |
adambakerwa | 43:11c5d098ce9d | 33 | *@param Gamepad class for working with the gamepad |
adambakerwa | 43:11c5d098ce9d | 34 | *@returns _gameover (0 when blockhead alive, 1 once died) (int) |
adambakerwa | 38:51ed5820ffe5 | 35 | */ |
adambakerwa | 25:230e4163cb6b | 36 | int playgame(N5110 &lcd, Gamepad &pad); |
adambakerwa | 38:51ed5820ffe5 | 37 | |
adambakerwa | 43:11c5d098ce9d | 38 | /** sets highscore if new highest level reached |
adambakerwa | 52:beeffd296ea3 | 39 | *@returns _highscore (int) |
adambakerwa | 38:51ed5820ffe5 | 40 | */ |
adambakerwa | 36:6f452777b9ce | 41 | int highscore(); |
adambakerwa | 36:6f452777b9ce | 42 | |
adambakerwa | 25:230e4163cb6b | 43 | private: |
adambakerwa | 25:230e4163cb6b | 44 | |
adambakerwa | 42:0dad7c359fa5 | 45 | Blockhead _blockhead; //blockhead class |
adambakerwa | 42:0dad7c359fa5 | 46 | Levels _lev; //levels class |
adambakerwa | 25:230e4163cb6b | 47 | |
adambakerwa | 42:0dad7c359fa5 | 48 | Pos _pos; //_pos struct |
adambakerwa | 25:230e4163cb6b | 49 | |
adambakerwa | 25:230e4163cb6b | 50 | |
adambakerwa | 42:0dad7c359fa5 | 51 | int _gameover; /**< _gameover flag (0 when alive, 1 onnce died) */ |
adambakerwa | 42:0dad7c359fa5 | 52 | int _level; /**< what level blockhead is on */ |
adambakerwa | 42:0dad7c359fa5 | 53 | int _highscore; /**< highest level reached */ |
adambakerwa | 25:230e4163cb6b | 54 | }; |
adambakerwa | 25:230e4163cb6b | 55 | |
adambakerwa | 25:230e4163cb6b | 56 | #endif |