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@16:1ee3d3804557, 2020-04-28 (annotated)
- Committer:
- evanso
- Date:
- Tue Apr 28 23:31:22 2020 +0000
- Revision:
- 16:1ee3d3804557
- Child:
- 17:25d79cca203a
Began work on weapons class. slightly changed map movement and spaceship movement functions to adjust where the spaceship sits on the screen when moving, in order to allow space for bullets.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
evanso | 16:1ee3d3804557 | 1 | #ifndef SPACESHIP_H |
evanso | 16:1ee3d3804557 | 2 | #define SPACESHIP_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 | 16:1ee3d3804557 | 26 | /** Draws laser bullets |
evanso | 16:1ee3d3804557 | 27 | * @param lcd, paosition_x_spaceship_, position_y_spaceship_ @details : N5110 object, x and y spaceship positions |
evanso | 16:1ee3d3804557 | 28 | */ |
evanso | 16:1ee3d3804557 | 29 | void draw_laser_bullets(N5110 &lcd, int position_x_spaceship_, int position_y_spaceship_, bool spaceship_sprite_direction_); |
evanso | 16:1ee3d3804557 | 30 | |
evanso | 16:1ee3d3804557 | 31 | // Accessors and mutators ----------------------------------------------- |
evanso | 16:1ee3d3804557 | 32 | |
evanso | 16:1ee3d3804557 | 33 | private: |
evanso | 16:1ee3d3804557 | 34 | // Function prototypes ----------------------------------------------------- |
evanso | 16:1ee3d3804557 | 35 | |
evanso | 16:1ee3d3804557 | 36 | // Variables --------------------------------------------------------------- |
evanso | 16:1ee3d3804557 | 37 | |
evanso | 16:1ee3d3804557 | 38 | // Spaceships x position on lcd |
evanso | 16:1ee3d3804557 | 39 | int position_x_bullets_; |
evanso | 16:1ee3d3804557 | 40 | |
evanso | 16:1ee3d3804557 | 41 | // Spaceships y position on lcd |
evanso | 16:1ee3d3804557 | 42 | int position_y_bullets_; |
evanso | 16:1ee3d3804557 | 43 | |
evanso | 16:1ee3d3804557 | 44 | }; |
evanso | 16:1ee3d3804557 | 45 | |
evanso | 16:1ee3d3804557 | 46 | #endif |