ELEC2645 (2019/20)
/
ELEC2645_Project_el18jb
test 1 doc
Ennemy/Enemy.h@14:58887d7e1072, 2020-05-27 (annotated)
- Committer:
- joebarhouch
- Date:
- Wed May 27 07:48:27 2020 +0000
- Revision:
- 14:58887d7e1072
- Parent:
- 11:b3024ab59fa5
final
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joebarhouch | 8:d19b30a6cd69 | 1 | #ifndef ENEMY_H |
joebarhouch | 8:d19b30a6cd69 | 2 | #define ENEMY_H |
joebarhouch | 8:d19b30a6cd69 | 3 | |
joebarhouch | 8:d19b30a6cd69 | 4 | #include "mbed.h" |
joebarhouch | 8:d19b30a6cd69 | 5 | #include "N5110.h" |
joebarhouch | 8:d19b30a6cd69 | 6 | #include "Gamepad.h" |
joebarhouch | 8:d19b30a6cd69 | 7 | #include "Bitmap.h" |
joebarhouch | 11:b3024ab59fa5 | 8 | |
joebarhouch | 11:b3024ab59fa5 | 9 | #define TYPE_VERT 1 |
joebarhouch | 11:b3024ab59fa5 | 10 | #define TYPE_HOR 0 |
joebarhouch | 8:d19b30a6cd69 | 11 | |
joebarhouch | 14:58887d7e1072 | 12 | /** Enemy Class |
joebarhouch | 14:58887d7e1072 | 13 | * @brief Class to control the enemies |
joebarhouch | 14:58887d7e1072 | 14 | * @author Joe Barhouch |
joebarhouch | 14:58887d7e1072 | 15 | * @author 201291584 |
joebarhouch | 14:58887d7e1072 | 16 | */ |
joebarhouch | 8:d19b30a6cd69 | 17 | class Enemy |
joebarhouch | 8:d19b30a6cd69 | 18 | { |
joebarhouch | 8:d19b30a6cd69 | 19 | |
joebarhouch | 8:d19b30a6cd69 | 20 | public: |
joebarhouch | 14:58887d7e1072 | 21 | /** Constructor |
joebarhouch | 14:58887d7e1072 | 22 | *@param Horizontal or Vertical enemy |
joebarhouch | 14:58887d7e1072 | 23 | *@param intial X |
joebarhouch | 14:58887d7e1072 | 24 | *@param intial Y |
joebarhouch | 14:58887d7e1072 | 25 | */ |
joebarhouch | 10:9317a62bd4d0 | 26 | Enemy(bool type,int spawnX, int spawnY); |
joebarhouch | 14:58887d7e1072 | 27 | /** Deconstructor */ |
joebarhouch | 8:d19b30a6cd69 | 28 | ~Enemy(); |
joebarhouch | 14:58887d7e1072 | 29 | /** Draw on the lcd |
joebarhouch | 14:58887d7e1072 | 30 | *@param lcd |
joebarhouch | 14:58887d7e1072 | 31 | */ |
joebarhouch | 8:d19b30a6cd69 | 32 | void draw(N5110 &lcd); |
joebarhouch | 14:58887d7e1072 | 33 | /** update speed |
joebarhouch | 14:58887d7e1072 | 34 | *@param set int speed |
joebarhouch | 14:58887d7e1072 | 35 | */ |
joebarhouch | 11:b3024ab59fa5 | 36 | void update(int _ev); |
joebarhouch | 14:58887d7e1072 | 37 | /** set position of enemies |
joebarhouch | 14:58887d7e1072 | 38 | *@param X coordinate |
joebarhouch | 14:58887d7e1072 | 39 | *@param Y coordinate |
joebarhouch | 14:58887d7e1072 | 40 | */ |
joebarhouch | 9:9830d3a78572 | 41 | void set_pos(int x, int y); |
joebarhouch | 14:58887d7e1072 | 42 | /** set position of enemies |
joebarhouch | 14:58887d7e1072 | 43 | *@return Vector2D of the position |
joebarhouch | 14:58887d7e1072 | 44 | */ |
joebarhouch | 8:d19b30a6cd69 | 45 | Vector2D get_pos(); |
joebarhouch | 8:d19b30a6cd69 | 46 | |
joebarhouch | 8:d19b30a6cd69 | 47 | |
joebarhouch | 8:d19b30a6cd69 | 48 | private: |
joebarhouch | 10:9317a62bd4d0 | 49 | |
joebarhouch | 10:9317a62bd4d0 | 50 | void drawVertical(N5110 &lcd); |
joebarhouch | 10:9317a62bd4d0 | 51 | void drawHoriz(N5110 &lcd); |
joebarhouch | 10:9317a62bd4d0 | 52 | bool _type; |
joebarhouch | 8:d19b30a6cd69 | 53 | int _enX; |
joebarhouch | 8:d19b30a6cd69 | 54 | int _enY; |
joebarhouch | 10:9317a62bd4d0 | 55 | |
joebarhouch | 10:9317a62bd4d0 | 56 | bool xDir; |
joebarhouch | 10:9317a62bd4d0 | 57 | bool yDir; |
joebarhouch | 8:d19b30a6cd69 | 58 | }; |
joebarhouch | 8:d19b30a6cd69 | 59 | |
joebarhouch | 8:d19b30a6cd69 | 60 | |
joebarhouch | 8:d19b30a6cd69 | 61 | #endif |