![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Adam Baker 201166301
Dependencies: mbed Gamepad N5110
BlockheadEngine/BlockheadEngine.h@41:4b20f909bbcb, 2019-05-08 (annotated)
- Committer:
- adambakerwa
- Date:
- Wed May 08 15:22:53 2019 +0000
- Revision:
- 41:4b20f909bbcb
- Parent:
- 38:51ed5820ffe5
- Child:
- 42:0dad7c359fa5
final amendments
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 | 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 | 38:51ed5820ffe5 | 20 | /** |
adambakerwa | 38:51ed5820ffe5 | 21 | *@brief Constructor |
adambakerwa | 38:51ed5820ffe5 | 22 | */ |
adambakerwa | 38:51ed5820ffe5 | 23 | BlockheadEngine(); |
adambakerwa | 25:230e4163cb6b | 24 | |
adambakerwa | 38:51ed5820ffe5 | 25 | /** |
adambakerwa | 38:51ed5820ffe5 | 26 | *@brief Deconstructor |
adambakerwa | 38:51ed5820ffe5 | 27 | */ |
adambakerwa | 25:230e4163cb6b | 28 | ~BlockheadEngine(); |
adambakerwa | 25:230e4163cb6b | 29 | |
adambakerwa | 38:51ed5820ffe5 | 30 | /** |
adambakerwa | 38:51ed5820ffe5 | 31 | *@brief Initialises variables in blockhead class and level class and _pos struct. |
adambakerwa | 38:51ed5820ffe5 | 32 | */ |
adambakerwa | 26:3319ddd5111d | 33 | void init(); |
adambakerwa | 38:51ed5820ffe5 | 34 | |
adambakerwa | 38:51ed5820ffe5 | 35 | /** |
adambakerwa | 38:51ed5820ffe5 | 36 | *@brief Intialises variables in blockhead class and level class and _pos struck (except level number which it keeps the same) |
adambakerwa | 38:51ed5820ffe5 | 37 | */ |
adambakerwa | 31:bf765e3961f1 | 38 | void continueInit(); |
adambakerwa | 38:51ed5820ffe5 | 39 | |
adambakerwa | 38:51ed5820ffe5 | 40 | /** |
adambakerwa | 38:51ed5820ffe5 | 41 | *@brief runs the game 'blockhead' |
adambakerwa | 38:51ed5820ffe5 | 42 | *@param lcd @brief class which controlls lcd screen |
adambakerwa | 38:51ed5820ffe5 | 43 | *@param pad @breif class for working with the gamepad |
adambakerwa | 38:51ed5820ffe5 | 44 | *@returns _gameover @brief (0 when blockhead alive, 1 once died) |
adambakerwa | 38:51ed5820ffe5 | 45 | */ |
adambakerwa | 25:230e4163cb6b | 46 | int playgame(N5110 &lcd, Gamepad &pad); |
adambakerwa | 38:51ed5820ffe5 | 47 | |
adambakerwa | 38:51ed5820ffe5 | 48 | /** |
adambakerwa | 38:51ed5820ffe5 | 49 | *@bried sets highscore if new highest level reached |
adambakerwa | 38:51ed5820ffe5 | 50 | *@retunrs _highscore |
adambakerwa | 38:51ed5820ffe5 | 51 | */ |
adambakerwa | 36:6f452777b9ce | 52 | int highscore(); |
adambakerwa | 36:6f452777b9ce | 53 | |
adambakerwa | 25:230e4163cb6b | 54 | private: |
adambakerwa | 25:230e4163cb6b | 55 | |
adambakerwa | 38:51ed5820ffe5 | 56 | Blockhead _blockhead; //blockhead class |
adambakerwa | 38:51ed5820ffe5 | 57 | Levels _lev; //levels class |
adambakerwa | 25:230e4163cb6b | 58 | |
adambakerwa | 38:51ed5820ffe5 | 59 | Pos _pos; //_pos struct |
adambakerwa | 25:230e4163cb6b | 60 | |
adambakerwa | 25:230e4163cb6b | 61 | |
adambakerwa | 38:51ed5820ffe5 | 62 | int _gameover; //_gameover flag (0 when alive, 1 onnce died) |
adambakerwa | 38:51ed5820ffe5 | 63 | int _level; //what level blockhead is on |
adambakerwa | 38:51ed5820ffe5 | 64 | int _highscore; //highest level reached |
adambakerwa | 25:230e4163cb6b | 65 | }; |
adambakerwa | 25:230e4163cb6b | 66 | |
adambakerwa | 25:230e4163cb6b | 67 | #endif |