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:
Sun May 17 21:12:34 2020 +0000
Revision:
40:71f947254fda
Child:
41:5959256f4aab
Added menu class wich scrolls through menu parts and displays them

Who changed what in which revision?

UserRevisionLine numberNew contents of line
evanso 40:71f947254fda 1 #ifndef MENU_H
evanso 40:71f947254fda 2 #define MENU_H
evanso 40:71f947254fda 3
evanso 40:71f947254fda 4 // Included libraries ----------------------------------------------------------
evanso 40:71f947254fda 5 #include "mbed.h"
evanso 40:71f947254fda 6 #include "N5110.h"
evanso 40:71f947254fda 7 #include "Gamepad.h"
evanso 40:71f947254fda 8
evanso 40:71f947254fda 9 /** Enum for diffent menu parts*/
evanso 40:71f947254fda 10 enum MenuParts {play, settings, savedgames, main_menu};
evanso 40:71f947254fda 11
evanso 40:71f947254fda 12 /** scroll_orderStruct
evanso 40:71f947254fda 13 * @brief Struct hold differnt menu orders
evanso 40:71f947254fda 14 */
evanso 40:71f947254fda 15 struct scroll_order {
evanso 40:71f947254fda 16 MenuParts part_next; /**< Next Menu part */
evanso 40:71f947254fda 17 MenuParts part_displayed; /**< Displayed menu part */
evanso 40:71f947254fda 18 };
evanso 40:71f947254fda 19
evanso 40:71f947254fda 20 /** Explosion class
evanso 40:71f947254fda 21 * @brief Selects and draws differnt menu parts
evanso 40:71f947254fda 22 * @author Benjamin Evans, University of Leeds
evanso 40:71f947254fda 23 * @date May 2020
evanso 40:71f947254fda 24 */
evanso 40:71f947254fda 25 class Menu{
evanso 40:71f947254fda 26 public:
evanso 40:71f947254fda 27 /** Constructor */
evanso 40:71f947254fda 28 Menu();
evanso 40:71f947254fda 29
evanso 40:71f947254fda 30 /** Destructor */
evanso 40:71f947254fda 31 ~Menu();
evanso 40:71f947254fda 32
evanso 40:71f947254fda 33 /** Initalises Menu*/
evanso 40:71f947254fda 34 void init();
evanso 40:71f947254fda 35
evanso 40:71f947254fda 36 /** sets the current menu part to the displayed when a is pressed
evanso 40:71f947254fda 37 * @param lcd @details N5110 object
evanso 40:71f947254fda 38 * @param pad @details Gamepad object
evanso 40:71f947254fda 39 */
evanso 40:71f947254fda 40 void select_part(N5110 &lcd, Gamepad &pad);
evanso 40:71f947254fda 41
evanso 40:71f947254fda 42 /** Draws the name of the part that is in the middle
evanso 40:71f947254fda 43 * @param lcd @details N5110 object
evanso 40:71f947254fda 44 */
evanso 40:71f947254fda 45 void draw_part(N5110 &lcd);
evanso 40:71f947254fda 46
evanso 40:71f947254fda 47 /** Scrolls through the diffent menu parts
evanso 40:71f947254fda 48 * @param pad @details Gamepad object
evanso 40:71f947254fda 49 * @param d_ @details Direction of joystick
evanso 40:71f947254fda 50 */
evanso 40:71f947254fda 51 void menu_scroll(Gamepad &pad, Direction d_);
evanso 40:71f947254fda 52
evanso 40:71f947254fda 53 private:
evanso 40:71f947254fda 54
evanso 40:71f947254fda 55 // Varibles ----------------------------------------------------------------
evanso 40:71f947254fda 56
evanso 40:71f947254fda 57 /** The part of the menu that is displayed */
evanso 40:71f947254fda 58 MenuParts displayed_menu_part_;
evanso 40:71f947254fda 59
evanso 40:71f947254fda 60 /** The part of the menu that is currently selected and in*/
evanso 40:71f947254fda 61 MenuParts current_menu_part_;
evanso 40:71f947254fda 62 };
evanso 40:71f947254fda 63 #endif