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