ELEC2645 (2018/19) / Mbed 2 deprecated el17aio

Dependencies:   mbed

Committer:
ikenna1
Date:
Wed May 08 15:50:40 2019 +0000
Revision:
43:500b8cff3715
Parent:
40:90c7a893d513
Child:
44:a6a361bea806
Test 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
ikenna1 43:500b8cff3715 25 /** A mutator method that initializes the value of the ship position and ship width
ikenna1 43:500b8cff3715 26 *@param The x position of the ship
ikenna1 43:500b8cff3715 27 *@param The y position of the ship
ikenna1 43:500b8cff3715 28 *@param the width of the ship
ikenna1 43:500b8cff3715 29 */
ikenna1 9:241a1a7d8527 30 void init(int ship_xpos, int ship_ypos, int ship_width);
ikenna1 43:500b8cff3715 31 /** Draws the appropriate weapon depending on the ship selected
ikenna1 43:500b8cff3715 32 *@param The N5110 library
ikenna1 43:500b8cff3715 33 *@param The Gamepad library
ikenna1 43:500b8cff3715 34 *@param shipno, a number representing ships 0 for kestrel 1 for imperion and 2 for orion
ikenna1 43:500b8cff3715 35 *@param closest, the position vector of the nearest enemy
ikenna1 43:500b8cff3715 36 */
ikenna1 43:500b8cff3715 37 void draw(N5110 &lcd,Gamepad &pad,SHIP shipUsed,Vector2D closest);
ikenna1 43:500b8cff3715 38 /** Accessor method that gets the position of the projectile where applicable(depends on ship)
ikenna1 43:500b8cff3715 39 *@param shipno, a number representing ships 0 for kestrel 1 for imperion and 2 for orion
ikenna1 43:500b8cff3715 40 @returns The 2D vector of the projectile fired from ship
ikenna1 43:500b8cff3715 41 */
ikenna1 43:500b8cff3715 42 Vector2D get_pos(SHIP _shipUsed);
ikenna1 43:500b8cff3715 43 /** Updates the missle position based on the missle velocity
ikenna1 43:500b8cff3715 44 */
ikenna1 9:241a1a7d8527 45 void update();
ikenna1 43:500b8cff3715 46 /** Mutator function used to set the position of the projectile to a specific coordinate on screen.
ikenna1 43:500b8cff3715 47 *used to reset the projectile after a collision with an enemy
ikenna1 43:500b8cff3715 48 *@param xpos, the ships x co-ordinate
ikenna1 43:500b8cff3715 49 *@param ypos, the ships y co-ordinate
ikenna1 9:241a1a7d8527 50 */
ikenna1 26:a53d41adf40b 51 void set_pos(int xpos, int ypos);
ikenna1 9:241a1a7d8527 52
ikenna1 9:241a1a7d8527 53 private:
ikenna1 43:500b8cff3715 54 //_______________Private-Variables__________________________________________
ikenna1 43:500b8cff3715 55 Enemy _enemy;
ikenna1 43:500b8cff3715 56 int _ship_xpos; // ship's x co-ordinate
ikenna1 43:500b8cff3715 57 int _ship_ypos; // ship's y co-ordinate
ikenna1 43:500b8cff3715 58 int reset; // variable to reset the kestrels missle
ikenna1 43:500b8cff3715 59 Vector2D _velocity; // vector to contain the velocity of the kestrels missle
ikenna1 43:500b8cff3715 60 int _x; // missle x co-ordinate
ikenna1 43:500b8cff3715 61 int _y; // missle y co-ordinate
ikenna1 9:241a1a7d8527 62
ikenna1 9:241a1a7d8527 63 };
ikenna1 9:241a1a7d8527 64 #endif