Ben Evans University Second Year Project. Game Called Defender.

Dependencies:   mbed

https://os.mbed.com/media/uploads/evanso/84bc1a30759fd6a1e3f1fd1fae3e97c2.png

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.

Committer:
evanso
Date:
Tue May 26 19:38:48 2020 +0000
Revision:
85:87bc28b151d8
Parent:
82:3211b31e9421
Child:
86:eecd168c3a23
Spell checked all of code and comments

Who changed what in which revision?

UserRevisionLine numberNew 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 "Gamepad.h"
evanso 75:643a509cf9ed 8 #include "SDFileSystem.h"
evanso 75:643a509cf9ed 9 #include "Sprites.h"
evanso 78:6a6c93c19ed1 10 #include "SDErrors.h"
evanso 75:643a509cf9ed 11
evanso 75:643a509cf9ed 12 /** High Score class
evanso 85:87bc28b151d8 13 * @brief Displays the highest score
evanso 75:643a509cf9ed 14 * @author Benjamin Evans, University of Leeds
evanso 75:643a509cf9ed 15 * @date May 2020
evanso 75:643a509cf9ed 16 */
evanso 78:6a6c93c19ed1 17 class HighScore:public SDErrors{
evanso 75:643a509cf9ed 18 public:
evanso 75:643a509cf9ed 19 /** Constructor */
evanso 75:643a509cf9ed 20 HighScore();
evanso 75:643a509cf9ed 21
evanso 75:643a509cf9ed 22 /** Destructor */
evanso 75:643a509cf9ed 23 ~HighScore();
evanso 75:643a509cf9ed 24
evanso 85:87bc28b151d8 25 /** Initialises HighScore
evanso 75:643a509cf9ed 26 */
evanso 75:643a509cf9ed 27 void init();
evanso 75:643a509cf9ed 28
evanso 85:87bc28b151d8 29 /** Saves the sore if a new High score
evanso 76:6daba3002424 30 * @param lcd @details N5110 object
evanso 76:6daba3002424 31 * @param sd @details sd card object
evanso 76:6daba3002424 32 * @param new_high_score
evanso 76:6daba3002424 33 */
evanso 76:6daba3002424 34 void save_new_high_score(SDFileSystem &sd, N5110 &lcd,
evanso 76:6daba3002424 35 int new_high_score);
evanso 76:6daba3002424 36
evanso 85:87bc28b151d8 37 /** Reads and returns the highest score
evanso 76:6daba3002424 38 * @param sd @details sd card object
evanso 76:6daba3002424 39 * @return high_score
evanso 76:6daba3002424 40 */
evanso 76:6daba3002424 41 int read_high_score(SDFileSystem &sd);
evanso 76:6daba3002424 42
evanso 76:6daba3002424 43 /** Draws no high scores screen
evanso 76:6daba3002424 44 * @param lcd @details N5110 object
evanso 76:6daba3002424 45 */
evanso 76:6daba3002424 46 void no_high_scores(N5110 &lcd);
evanso 76:6daba3002424 47
evanso 79:66bcf8fa2d2d 48 /** Runs the save test unit test
evanso 79:66bcf8fa2d2d 49 * @param lcd @details N5110 object
evanso 79:66bcf8fa2d2d 50 * @param sd @details sd card object
evanso 79:66bcf8fa2d2d 51 */
evanso 79:66bcf8fa2d2d 52 void run_save_test(SDFileSystem &sd, N5110 &lcd);
evanso 79:66bcf8fa2d2d 53
evanso 75:643a509cf9ed 54 private:
evanso 75:643a509cf9ed 55 // Function prototypes -----------------------------------------------------
evanso 76:6daba3002424 56
evanso 82:3211b31e9421 57 /** Shows error if high data files opens incorrectly
evanso 76:6daba3002424 58 * @param lcd @details N5110 object
evanso 76:6daba3002424 59 */
evanso 76:6daba3002424 60 void error_open_file(N5110 &lcd);
evanso 76:6daba3002424 61
evanso 79:66bcf8fa2d2d 62 /** Save test unit test, checks the saving and reading functions work
evanso 79:66bcf8fa2d2d 63 * @param lcd @details N5110 object
evanso 79:66bcf8fa2d2d 64 * @param sd @details sd card object
evanso 82:3211b31e9421 65 * @param score @details score at end of game
evanso 79:66bcf8fa2d2d 66 */
evanso 79:66bcf8fa2d2d 67 bool save_test(int score,SDFileSystem &sd, N5110 &lcd);
evanso 79:66bcf8fa2d2d 68
evanso 75:643a509cf9ed 69 };
evanso 85:87bc28b151d8 70 #endif