ELEC2645 (2018/19) / Mbed 2 deprecated el17rrrs

Dependencies:   mbed Gamepad N5110 mbed-rtos

Committer:
RexRoshan
Date:
Thu May 09 09:49:35 2019 +0000
Revision:
0:d9cf94b41df3
Documentation has been completed and the code has been slightly modified

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RexRoshan 0:d9cf94b41df3 1 #ifndef ENEMY_H
RexRoshan 0:d9cf94b41df3 2 #define ENEMY_H
RexRoshan 0:d9cf94b41df3 3
RexRoshan 0:d9cf94b41df3 4 #include "mbed.h"
RexRoshan 0:d9cf94b41df3 5 #include "N5110.h"
RexRoshan 0:d9cf94b41df3 6 #include "Gamepad.h"
RexRoshan 0:d9cf94b41df3 7
RexRoshan 0:d9cf94b41df3 8 /** Enemy Class
RexRoshan 0:d9cf94b41df3 9 * @brief Enemy for stage one
RexRoshan 0:d9cf94b41df3 10 * @author Rex Roshan Raj
RexRoshan 0:d9cf94b41df3 11 */
RexRoshan 0:d9cf94b41df3 12 class Enemy
RexRoshan 0:d9cf94b41df3 13 {
RexRoshan 0:d9cf94b41df3 14
RexRoshan 0:d9cf94b41df3 15 public:
RexRoshan 0:d9cf94b41df3 16 /** Constructor */
RexRoshan 0:d9cf94b41df3 17 Enemy();
RexRoshan 0:d9cf94b41df3 18
RexRoshan 0:d9cf94b41df3 19 /** Destructor */
RexRoshan 0:d9cf94b41df3 20 ~Enemy();
RexRoshan 0:d9cf94b41df3 21
RexRoshan 0:d9cf94b41df3 22 /** Initialise all the parameters for enemy in stage one
RexRoshan 0:d9cf94b41df3 23 *@param a - x position of the enemy
RexRoshan 0:d9cf94b41df3 24 *@param b - y position of the enemy
RexRoshan 0:d9cf94b41df3 25 */
RexRoshan 0:d9cf94b41df3 26 void init(int a,int b);
RexRoshan 0:d9cf94b41df3 27
RexRoshan 0:d9cf94b41df3 28 /** Generates the location
RexRoshan 0:d9cf94b41df3 29 * @brief Generates and sets the location of the enemy once it has been hit
RexRoshan 0:d9cf94b41df3 30 */
RexRoshan 0:d9cf94b41df3 31 void location();
RexRoshan 0:d9cf94b41df3 32
RexRoshan 0:d9cf94b41df3 33 /** Draws the enemy
RexRoshan 0:d9cf94b41df3 34 * @param N5110 lcd
RexRoshan 0:d9cf94b41df3 35 * @brief Draws the enemy in stage one
RexRoshan 0:d9cf94b41df3 36 */
RexRoshan 0:d9cf94b41df3 37 void enemy(N5110 &lcd);
RexRoshan 0:d9cf94b41df3 38
RexRoshan 0:d9cf94b41df3 39 /** Updates the movement
RexRoshan 0:d9cf94b41df3 40 * @brief Changes the y position for animation once the enemy has died
RexRoshan 0:d9cf94b41df3 41 */
RexRoshan 0:d9cf94b41df3 42 void update();
RexRoshan 0:d9cf94b41df3 43
RexRoshan 0:d9cf94b41df3 44 /** Adds the value of health by 1 */
RexRoshan 0:d9cf94b41df3 45 void add_health();
RexRoshan 0:d9cf94b41df3 46
RexRoshan 0:d9cf94b41df3 47 /** Gets the value of the health
RexRoshan 0:d9cf94b41df3 48 * @returns value in range 0 to 10
RexRoshan 0:d9cf94b41df3 49 */
RexRoshan 0:d9cf94b41df3 50 int get_health();
RexRoshan 0:d9cf94b41df3 51
RexRoshan 0:d9cf94b41df3 52 /** Gets the position of the enemy
RexRoshan 0:d9cf94b41df3 53 * @returns a struct with x,y members which corresponds to x and y position respectively
RexRoshan 0:d9cf94b41df3 54 */
RexRoshan 0:d9cf94b41df3 55 Vector2D get_enemy_pos();
RexRoshan 0:d9cf94b41df3 56
RexRoshan 0:d9cf94b41df3 57 /** Sets the position of the enemy
RexRoshan 0:d9cf94b41df3 58 * @param position of the enemy
RexRoshan 0:d9cf94b41df3 59 */
RexRoshan 0:d9cf94b41df3 60 void set_enemy_pos(Vector2D e);
RexRoshan 0:d9cf94b41df3 61
RexRoshan 0:d9cf94b41df3 62 private:
RexRoshan 0:d9cf94b41df3 63
RexRoshan 0:d9cf94b41df3 64 // methods
RexRoshan 0:d9cf94b41df3 65 int _a;
RexRoshan 0:d9cf94b41df3 66 int _b;
RexRoshan 0:d9cf94b41df3 67 int _speed;
RexRoshan 0:d9cf94b41df3 68 int _fast;
RexRoshan 0:d9cf94b41df3 69 int _health;
RexRoshan 0:d9cf94b41df3 70
RexRoshan 0:d9cf94b41df3 71 };
RexRoshan 0:d9cf94b41df3 72
RexRoshan 0:d9cf94b41df3 73 #endif