Ben Evans University Second Year Project. Game Called Defender.
Hello, soldier, you have been specially selected as the defender of planet earth.
Your mission, if you choose to accept it. Fly around the planet and pulverise invading alien ships for as long as you can. Stop the aliens abducting the innocent people on the ground. Be warned if an alien ship manages to abduct a person and take them to top of the screen, they will no longer move randomly and will begin to hunt you down. This sounds like a challenge you were trained for.
But don’t worry soldier you’re not going into battle empty-handed. Your ship is equipped with a state of the art laser beam that has unlimited ammo and four smart bombs that will destroy anything on the screen. The ship also has three lives so use them wisely.
As time goes on more alien ships will arrive on planet earth increasing the difficulty of your mission. And remember the landscape bellow loops around so if you continually fly in the same direction you go to your original position. Good luck soldier.
HighScore/HighScore.h@86:eecd168c3a23, 2020-05-27 (annotated)
- Committer:
- evanso
- Date:
- Wed May 27 00:32:04 2020 +0000
- Revision:
- 86:eecd168c3a23
- Parent:
- 85:87bc28b151d8
Fixed bugs in play game and removed any excess included headers.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
evanso | 75:643a509cf9ed | 1 | #ifndef HIGHSCORE_H |
evanso | 75:643a509cf9ed | 2 | #define HIGHSCORE_H |
evanso | 75:643a509cf9ed | 3 | |
evanso | 82:3211b31e9421 | 4 | // Included Headers ------------------------------------------------------------ |
evanso | 75:643a509cf9ed | 5 | #include "mbed.h" |
evanso | 75:643a509cf9ed | 6 | #include "N5110.h" |
evanso | 75:643a509cf9ed | 7 | #include "SDFileSystem.h" |
evanso | 75:643a509cf9ed | 8 | #include "Sprites.h" |
evanso | 78:6a6c93c19ed1 | 9 | #include "SDErrors.h" |
evanso | 75:643a509cf9ed | 10 | |
evanso | 75:643a509cf9ed | 11 | /** High Score class |
evanso | 85:87bc28b151d8 | 12 | * @brief Displays the highest score |
evanso | 75:643a509cf9ed | 13 | * @author Benjamin Evans, University of Leeds |
evanso | 75:643a509cf9ed | 14 | * @date May 2020 |
evanso | 75:643a509cf9ed | 15 | */ |
evanso | 78:6a6c93c19ed1 | 16 | class HighScore:public SDErrors{ |
evanso | 75:643a509cf9ed | 17 | public: |
evanso | 75:643a509cf9ed | 18 | /** Constructor */ |
evanso | 75:643a509cf9ed | 19 | HighScore(); |
evanso | 75:643a509cf9ed | 20 | |
evanso | 75:643a509cf9ed | 21 | /** Destructor */ |
evanso | 75:643a509cf9ed | 22 | ~HighScore(); |
evanso | 75:643a509cf9ed | 23 | |
evanso | 85:87bc28b151d8 | 24 | /** Initialises HighScore |
evanso | 75:643a509cf9ed | 25 | */ |
evanso | 75:643a509cf9ed | 26 | void init(); |
evanso | 75:643a509cf9ed | 27 | |
evanso | 85:87bc28b151d8 | 28 | /** Saves the sore if a new High score |
evanso | 76:6daba3002424 | 29 | * @param lcd @details N5110 object |
evanso | 76:6daba3002424 | 30 | * @param sd @details sd card object |
evanso | 76:6daba3002424 | 31 | * @param new_high_score |
evanso | 76:6daba3002424 | 32 | */ |
evanso | 76:6daba3002424 | 33 | void save_new_high_score(SDFileSystem &sd, N5110 &lcd, |
evanso | 76:6daba3002424 | 34 | int new_high_score); |
evanso | 76:6daba3002424 | 35 | |
evanso | 85:87bc28b151d8 | 36 | /** Reads and returns the highest score |
evanso | 76:6daba3002424 | 37 | * @param sd @details sd card object |
evanso | 76:6daba3002424 | 38 | * @return high_score |
evanso | 76:6daba3002424 | 39 | */ |
evanso | 76:6daba3002424 | 40 | int read_high_score(SDFileSystem &sd); |
evanso | 76:6daba3002424 | 41 | |
evanso | 76:6daba3002424 | 42 | /** Draws no high scores screen |
evanso | 76:6daba3002424 | 43 | * @param lcd @details N5110 object |
evanso | 76:6daba3002424 | 44 | */ |
evanso | 76:6daba3002424 | 45 | void no_high_scores(N5110 &lcd); |
evanso | 76:6daba3002424 | 46 | |
evanso | 79:66bcf8fa2d2d | 47 | /** Runs the save test unit test |
evanso | 79:66bcf8fa2d2d | 48 | * @param lcd @details N5110 object |
evanso | 79:66bcf8fa2d2d | 49 | * @param sd @details sd card object |
evanso | 79:66bcf8fa2d2d | 50 | */ |
evanso | 79:66bcf8fa2d2d | 51 | void run_save_test(SDFileSystem &sd, N5110 &lcd); |
evanso | 79:66bcf8fa2d2d | 52 | |
evanso | 75:643a509cf9ed | 53 | private: |
evanso | 75:643a509cf9ed | 54 | // Function prototypes ----------------------------------------------------- |
evanso | 76:6daba3002424 | 55 | |
evanso | 82:3211b31e9421 | 56 | /** Shows error if high data files opens incorrectly |
evanso | 76:6daba3002424 | 57 | * @param lcd @details N5110 object |
evanso | 76:6daba3002424 | 58 | */ |
evanso | 76:6daba3002424 | 59 | void error_open_file(N5110 &lcd); |
evanso | 76:6daba3002424 | 60 | |
evanso | 79:66bcf8fa2d2d | 61 | /** Save test unit test, checks the saving and reading functions work |
evanso | 79:66bcf8fa2d2d | 62 | * @param lcd @details N5110 object |
evanso | 79:66bcf8fa2d2d | 63 | * @param sd @details sd card object |
evanso | 82:3211b31e9421 | 64 | * @param score @details score at end of game |
evanso | 79:66bcf8fa2d2d | 65 | */ |
evanso | 79:66bcf8fa2d2d | 66 | bool save_test(int score,SDFileSystem &sd, N5110 &lcd); |
evanso | 79:66bcf8fa2d2d | 67 | |
evanso | 75:643a509cf9ed | 68 | }; |
evanso | 85:87bc28b151d8 | 69 | #endif |