Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Weapons/Weapons.h
- Committer:
- ikenna1
- Date:
- 2019-05-08
- Revision:
- 43:500b8cff3715
- Parent:
- 40:90c7a893d513
- Child:
- 44:a6a361bea806
File content as of revision 43:500b8cff3715:
#ifndef WEAPONS_H #define WEAPONS_H #include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include "Ship.h" #include "Enemy.h" /** Weapon Class @brief Draws the weapons used by all ships in the game @author Ozoemena Adrian Ikrnna @date 8th March 2019 */ class Weapons { public: Weapons(); ~Weapons(); /** A mutator method that initializes the value of the ship position and ship width *@param The x position of the ship *@param The y position of the ship *@param the width of the ship */ void init(int ship_xpos, int ship_ypos, int ship_width); /** Draws the appropriate weapon depending on the ship selected *@param The N5110 library *@param The Gamepad library *@param shipno, a number representing ships 0 for kestrel 1 for imperion and 2 for orion *@param closest, the position vector of the nearest enemy */ void draw(N5110 &lcd,Gamepad &pad,SHIP shipUsed,Vector2D closest); /** Accessor method that gets the position of the projectile where applicable(depends on ship) *@param shipno, a number representing ships 0 for kestrel 1 for imperion and 2 for orion @returns The 2D vector of the projectile fired from ship */ Vector2D get_pos(SHIP _shipUsed); /** Updates the missle position based on the missle velocity */ void update(); /** Mutator function used to set the position of the projectile to a specific coordinate on screen. *used to reset the projectile after a collision with an enemy *@param xpos, the ships x co-ordinate *@param ypos, the ships y co-ordinate */ void set_pos(int xpos, int ypos); private: //_______________Private-Variables__________________________________________ Enemy _enemy; int _ship_xpos; // ship's x co-ordinate int _ship_ypos; // ship's y co-ordinate int reset; // variable to reset the kestrels missle Vector2D _velocity; // vector to contain the velocity of the kestrels missle int _x; // missle x co-ordinate int _y; // missle y co-ordinate }; #endif