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:
Wed May 27 02:06:05 2020 +0000
Revision:
87:832ca78426b5
Parent:
86:eecd168c3a23
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
evanso 25:70b55f5bfc87 1 #ifndef EXPLOSION_H
evanso 25:70b55f5bfc87 2 #define EXPLOSION_H
evanso 25:70b55f5bfc87 3
evanso 82:3211b31e9421 4 // Included Headers ------------------------------------------------------------
evanso 25:70b55f5bfc87 5 #include "mbed.h"
evanso 25:70b55f5bfc87 6 #include "N5110.h"
evanso 27:8bb2bd97c319 7 #include "Position.h"
evanso 25:70b55f5bfc87 8
evanso 27:8bb2bd97c319 9 /** Animation Struct
evanso 27:8bb2bd97c319 10 * @brief Struct to draw explosion animation
evanso 27:8bb2bd97c319 11 */
evanso 27:8bb2bd97c319 12 struct Animation{
evanso 27:8bb2bd97c319 13 bool draw_circle_one; /**< Bool to draw circle one */
evanso 27:8bb2bd97c319 14 bool draw_circle_two; /**< Bool to draw circle two */
evanso 27:8bb2bd97c319 15 FillType circle_one; /**< Fill type of circle one */
evanso 27:8bb2bd97c319 16 FillType circle_two; /**< Fill type of circle two */
evanso 27:8bb2bd97c319 17 };
evanso 27:8bb2bd97c319 18
evanso 25:70b55f5bfc87 19 /** Explosion class
evanso 27:8bb2bd97c319 20 * @brief Draws explosion animation
evanso 27:8bb2bd97c319 21 * @author Benjamin Evans, University of Leeds
evanso 27:8bb2bd97c319 22 * @date May 2020
evanso 27:8bb2bd97c319 23 */
evanso 83:35d1e846eab2 24 class Explosion: public Position {
evanso 25:70b55f5bfc87 25 public:
evanso 25:70b55f5bfc87 26 /** Constructor */
evanso 25:70b55f5bfc87 27 Explosion();
evanso 25:70b55f5bfc87 28
evanso 25:70b55f5bfc87 29 /** Destructor */
evanso 25:70b55f5bfc87 30 ~Explosion();
evanso 25:70b55f5bfc87 31
evanso 85:87bc28b151d8 32 /** Initialises explosion
evanso 85:87bc28b151d8 33 * @param destroyed_position @details Vector2D of destroyed xy pos
evanso 29:e96d91f1d39c 34 */
evanso 29:e96d91f1d39c 35 void init(Vector2D destroyed_position);
evanso 25:70b55f5bfc87 36
evanso 25:70b55f5bfc87 37 /** Draws the explosion
evanso 27:8bb2bd97c319 38 * @param lcd @details N5110 object
evanso 25:70b55f5bfc87 39 */
evanso 25:70b55f5bfc87 40 void draw_explosion(N5110 &lcd);
evanso 25:70b55f5bfc87 41
evanso 25:70b55f5bfc87 42 // Accessors and mutators --------------------------------------------------
evanso 25:70b55f5bfc87 43
evanso 25:70b55f5bfc87 44 /** Gets the explosion radius
evanso 25:70b55f5bfc87 45 * @returns explosion_radius_
evanso 25:70b55f5bfc87 46 */
evanso 25:70b55f5bfc87 47 int get_explosion_radius();
evanso 25:70b55f5bfc87 48
evanso 25:70b55f5bfc87 49 private:
evanso 25:70b55f5bfc87 50
evanso 85:87bc28b151d8 51 // Variables ---------------------------------------------------------------
evanso 25:70b55f5bfc87 52
evanso 27:8bb2bd97c319 53 /** Explosion circle radius */
evanso 25:70b55f5bfc87 54 int explosion_radius_;
evanso 25:70b55f5bfc87 55
evanso 27:8bb2bd97c319 56 /** FSM counter for state in FSM */
evanso 25:70b55f5bfc87 57 int fsm_counter_;
evanso 25:70b55f5bfc87 58
evanso 27:8bb2bd97c319 59 /** Draw cunter */
evanso 25:70b55f5bfc87 60 int draw_counter;
evanso 25:70b55f5bfc87 61 };
evanso 25:70b55f5bfc87 62
evanso 85:87bc28b151d8 63 #endif