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.
Weapons/Weapons.h@17:25d79cca203a, 2020-04-29 (annotated)
- Committer:
- evanso
- Date:
- Wed Apr 29 12:35:14 2020 +0000
- Revision:
- 17:25d79cca203a
- Parent:
- 16:1ee3d3804557
- Child:
- 18:11068b98e261
Changed spaceship class to return x and y position as a Vector2D. Added calculate bullet start position function to weapons class.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
evanso | 17:25d79cca203a | 1 | #ifndef WEAPONS_H |
evanso | 17:25d79cca203a | 2 | #define WEAPONS_H |
evanso | 16:1ee3d3804557 | 3 | |
evanso | 16:1ee3d3804557 | 4 | // Included libraries ----------------------------------------------------------- |
evanso | 16:1ee3d3804557 | 5 | #include "mbed.h" |
evanso | 16:1ee3d3804557 | 6 | #include "N5110.h" |
evanso | 16:1ee3d3804557 | 7 | #include "Gamepad.h" |
evanso | 16:1ee3d3804557 | 8 | |
evanso | 16:1ee3d3804557 | 9 | /** Weapons class |
evanso | 16:1ee3d3804557 | 10 | @brief Draws and moves weapons |
evanso | 16:1ee3d3804557 | 11 | @author Benjamin Evans, University of Leeds |
evanso | 16:1ee3d3804557 | 12 | @date April 2020 |
evanso | 16:1ee3d3804557 | 13 | */ |
evanso | 16:1ee3d3804557 | 14 | |
evanso | 16:1ee3d3804557 | 15 | class Weapons { |
evanso | 16:1ee3d3804557 | 16 | public: |
evanso | 16:1ee3d3804557 | 17 | /** Constructor */ |
evanso | 16:1ee3d3804557 | 18 | Weapons(); |
evanso | 16:1ee3d3804557 | 19 | |
evanso | 16:1ee3d3804557 | 20 | /** Destructor */ |
evanso | 16:1ee3d3804557 | 21 | ~Weapons(); |
evanso | 16:1ee3d3804557 | 22 | |
evanso | 16:1ee3d3804557 | 23 | /** Initalises Weapons */ |
evanso | 16:1ee3d3804557 | 24 | void init(); |
evanso | 16:1ee3d3804557 | 25 | |
evanso | 17:25d79cca203a | 26 | /** Calculates bullets start postion |
evanso | 17:25d79cca203a | 27 | * @param spaceship_pos @details x and y postion of spaceship |
evanso | 17:25d79cca203a | 28 | * @param spaceship_sprite_direction_ @details sprite direction bool, true = E, false = W |
evanso | 16:1ee3d3804557 | 29 | */ |
evanso | 17:25d79cca203a | 30 | void calc_bullets_start_pos(Vector2D spaceship_pos, bool spaceship_sprite_direction_); |
evanso | 16:1ee3d3804557 | 31 | |
evanso | 16:1ee3d3804557 | 32 | // Accessors and mutators ----------------------------------------------- |
evanso | 16:1ee3d3804557 | 33 | |
evanso | 17:25d79cca203a | 34 | /** Gets the xy position of the bullet |
evanso | 17:25d79cca203a | 35 | * @returns position_x_spaceship_, position_x_spaceship_ |
evanso | 17:25d79cca203a | 36 | */ |
evanso | 17:25d79cca203a | 37 | Vector2D get_pos(); |
evanso | 16:1ee3d3804557 | 38 | private: |
evanso | 16:1ee3d3804557 | 39 | // Function prototypes ----------------------------------------------------- |
evanso | 16:1ee3d3804557 | 40 | |
evanso | 16:1ee3d3804557 | 41 | // Variables --------------------------------------------------------------- |
evanso | 17:25d79cca203a | 42 | |
evanso | 17:25d79cca203a | 43 | // bullets x position on lcd |
evanso | 17:25d79cca203a | 44 | int position_x_bullet_; |
evanso | 16:1ee3d3804557 | 45 | |
evanso | 17:25d79cca203a | 46 | // bullets y position on lcd |
evanso | 17:25d79cca203a | 47 | int position_y_bullet_; |
evanso | 16:1ee3d3804557 | 48 | |
evanso | 16:1ee3d3804557 | 49 | }; |
evanso | 16:1ee3d3804557 | 50 | |
evanso | 16:1ee3d3804557 | 51 | #endif |