ELEC2645 (2018/19) / Mbed 2 deprecated el17aio

Dependencies:   mbed

Committer:
ikenna1
Date:
Wed May 08 16:46:21 2019 +0000
Revision:
44:a6a361bea806
Parent:
43:500b8cff3715
Child:
45:fe5fc85a5c73
Add Enum SHIP to make selecting ships easier. started documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ikenna1 9:241a1a7d8527 1 #ifndef WEAPONS_H
ikenna1 9:241a1a7d8527 2 #define WEAPONS_H
ikenna1 9:241a1a7d8527 3
ikenna1 9:241a1a7d8527 4 #include "mbed.h"
ikenna1 9:241a1a7d8527 5 #include "N5110.h"
ikenna1 9:241a1a7d8527 6 #include "Gamepad.h"
ikenna1 9:241a1a7d8527 7 #include "Ship.h"
ikenna1 40:90c7a893d513 8 #include "Enemy.h"
ikenna1 9:241a1a7d8527 9
ikenna1 43:500b8cff3715 10
ikenna1 43:500b8cff3715 11 /** Weapon Class
ikenna1 43:500b8cff3715 12 @brief Draws the weapons used by all ships in the game
ikenna1 43:500b8cff3715 13 @author Ozoemena Adrian Ikrnna
ikenna1 43:500b8cff3715 14 @date 8th March 2019
ikenna1 43:500b8cff3715 15 */
ikenna1 43:500b8cff3715 16
ikenna1 9:241a1a7d8527 17 class Weapons
ikenna1 9:241a1a7d8527 18 {
ikenna1 9:241a1a7d8527 19 public:
ikenna1 9:241a1a7d8527 20 Weapons();
ikenna1 9:241a1a7d8527 21 ~Weapons();
ikenna1 9:241a1a7d8527 22
ikenna1 43:500b8cff3715 23
ikenna1 43:500b8cff3715 24 /** A mutator method that initializes the value of the ship position and ship width
ikenna1 43:500b8cff3715 25 *@param The x position of the ship
ikenna1 43:500b8cff3715 26 *@param The y position of the ship
ikenna1 43:500b8cff3715 27 *@param the width of the ship
ikenna1 43:500b8cff3715 28 */
ikenna1 9:241a1a7d8527 29 void init(int ship_xpos, int ship_ypos, int ship_width);
ikenna1 43:500b8cff3715 30 /** Draws the appropriate weapon depending on the ship selected
ikenna1 43:500b8cff3715 31 *@param The N5110 library
ikenna1 43:500b8cff3715 32 *@param The Gamepad library
ikenna1 44:a6a361bea806 33 *@param shipUsed, a variable of enum SHIP which contains the ship currently being used
ikenna1 43:500b8cff3715 34 *@param closest, the position vector of the nearest enemy
ikenna1 43:500b8cff3715 35 */
ikenna1 43:500b8cff3715 36 void draw(N5110 &lcd,Gamepad &pad,SHIP shipUsed,Vector2D closest);
ikenna1 43:500b8cff3715 37 /** Accessor method that gets the position of the projectile where applicable(depends on ship)
ikenna1 44:a6a361bea806 38 *@param shipUsed, a variable of enum SHIP which contains the ship currently being used
ikenna1 43:500b8cff3715 39 @returns The 2D vector of the projectile fired from ship
ikenna1 43:500b8cff3715 40 */
ikenna1 43:500b8cff3715 41 Vector2D get_pos(SHIP _shipUsed);
ikenna1 43:500b8cff3715 42 /** Updates the missle position based on the missle velocity
ikenna1 43:500b8cff3715 43 */
ikenna1 9:241a1a7d8527 44 void update();
ikenna1 43:500b8cff3715 45 /** Mutator function used to set the position of the projectile to a specific coordinate on screen.
ikenna1 43:500b8cff3715 46 *used to reset the projectile after a collision with an enemy
ikenna1 43:500b8cff3715 47 *@param xpos, the ships x co-ordinate
ikenna1 43:500b8cff3715 48 *@param ypos, the ships y co-ordinate
ikenna1 9:241a1a7d8527 49 */
ikenna1 26:a53d41adf40b 50 void set_pos(int xpos, int ypos);
ikenna1 9:241a1a7d8527 51
ikenna1 9:241a1a7d8527 52 private:
ikenna1 43:500b8cff3715 53 //_______________Private-Variables__________________________________________
ikenna1 43:500b8cff3715 54 Enemy _enemy;
ikenna1 43:500b8cff3715 55 int _ship_xpos; // ship's x co-ordinate
ikenna1 43:500b8cff3715 56 int _ship_ypos; // ship's y co-ordinate
ikenna1 43:500b8cff3715 57 int reset; // variable to reset the kestrels missle
ikenna1 43:500b8cff3715 58 Vector2D _velocity; // vector to contain the velocity of the kestrels missle
ikenna1 43:500b8cff3715 59 int _x; // missle x co-ordinate
ikenna1 43:500b8cff3715 60 int _y; // missle y co-ordinate
ikenna1 9:241a1a7d8527 61
ikenna1 9:241a1a7d8527 62 };
ikenna1 9:241a1a7d8527 63 #endif