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:
85:87bc28b151d8
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
evanso 36:27aa597db3d2 1 #ifndef CHECKALIENCOLLISION_H
evanso 36:27aa597db3d2 2 #define CHECKALIENCOLLISION_H
evanso 36:27aa597db3d2 3
evanso 82:3211b31e9421 4 // Included Headers ------------------------------------------------------------
evanso 36:27aa597db3d2 5 #include "mbed.h"
evanso 36:27aa597db3d2 6 #include "Position.h"
evanso 36:27aa597db3d2 7 #include "Alien.h"
evanso 36:27aa597db3d2 8
evanso 82:3211b31e9421 9 /** CheckAlienCollision class
evanso 85:87bc28b151d8 10 * @brief Check Alien Collision parent class
evanso 36:27aa597db3d2 11 * @author Benjamin Evans, University of Leeds
evanso 36:27aa597db3d2 12 * @date May 2020
evanso 36:27aa597db3d2 13 */
evanso 36:27aa597db3d2 14 class CheckAlienCollision: virtual public Position{
evanso 36:27aa597db3d2 15 public:
evanso 36:27aa597db3d2 16 // Function prototypes -----------------------------------------------------
evanso 36:27aa597db3d2 17
evanso 36:27aa597db3d2 18 /** Checks if alien collides with a sprite
evanso 36:27aa597db3d2 19 * @param alien @details Alien object
evanso 36:27aa597db3d2 20 */
evanso 36:27aa597db3d2 21 bool check_alien_collision(Alien alien);
evanso 36:27aa597db3d2 22
evanso 36:27aa597db3d2 23 protected:
evanso 36:27aa597db3d2 24 // Function prototypes -----------------------------------------------------
evanso 36:27aa597db3d2 25
evanso 36:27aa597db3d2 26 /** Checks if alien collides with top right of sprite and return flag
evanso 36:27aa597db3d2 27 * @param alien @details Alien object
evanso 36:27aa597db3d2 28 * @param alien_pos @details vector2D of alien xy position
evanso 85:87bc28b151d8 29 * @return check_collision @details check collision flag
evanso 36:27aa597db3d2 30 */
evanso 36:27aa597db3d2 31 bool check_top_right(Alien alien, Vector2D alien_pos);
evanso 36:27aa597db3d2 32
evanso 36:27aa597db3d2 33 /** Checks if alien collides with top left of sprite and return flag
evanso 36:27aa597db3d2 34 * @param alien @details Alien object
evanso 36:27aa597db3d2 35 * @param alien_pos @details vector2D of alien xy position
evanso 85:87bc28b151d8 36 * @return check_collision @details check collision flag
evanso 36:27aa597db3d2 37 */
evanso 36:27aa597db3d2 38 bool check_top_left(Alien alien, Vector2D alien_pos);
evanso 36:27aa597db3d2 39
evanso 36:27aa597db3d2 40 /** Checks if alien collides with bottom right sprite and return flag
evanso 36:27aa597db3d2 41 * @param alien @details Alien object
evanso 36:27aa597db3d2 42 * @param alien_pos @details vector2D of alien xy position
evanso 85:87bc28b151d8 43 * @return check_collision @details check collision flag
evanso 36:27aa597db3d2 44 */
evanso 36:27aa597db3d2 45 bool check_bottom_right(Alien alien, Vector2D alien_pos);
evanso 36:27aa597db3d2 46
evanso 36:27aa597db3d2 47 /** Checks if alien collides with bottom left sprite and return flag
evanso 36:27aa597db3d2 48 * @param alien @details Alien object
evanso 36:27aa597db3d2 49 * @param alien_pos @details vector2D of alien xy position
evanso 85:87bc28b151d8 50 * @return check_collision @details check collision flag
evanso 36:27aa597db3d2 51 */
evanso 36:27aa597db3d2 52 bool check_bottom_left(Alien alien, Vector2D alien_pos);
evanso 36:27aa597db3d2 53
evanso 36:27aa597db3d2 54 // Variables ---------------------------------------------------------------
evanso 36:27aa597db3d2 55
evanso 36:27aa597db3d2 56 /** Length of sprite in x direction */
evanso 36:27aa597db3d2 57 int sprite_x_length;
evanso 36:27aa597db3d2 58
evanso 36:27aa597db3d2 59 /** Length of sprite in y direction */
evanso 36:27aa597db3d2 60 int sprite_y_length;
evanso 36:27aa597db3d2 61
evanso 36:27aa597db3d2 62 /** Flag if there is is a alien collision*/
evanso 36:27aa597db3d2 63 bool alien_collision_flag;
evanso 40:71f947254fda 64
evanso 40:71f947254fda 65 /** Flag if the alien that colided is tracking */
evanso 40:71f947254fda 66 bool alien_track;
evanso 36:27aa597db3d2 67 };
evanso 36:27aa597db3d2 68
evanso 85:87bc28b151d8 69 #endif