Mortal Kombat Game ELEC2645
Dependencies: mbed N5110 ShiftReg Joystick
Enemy.h@5:889ad974b64d, 2021-04-20 (annotated)
- Committer:
- ozy
- Date:
- Tue Apr 20 09:01:35 2021 +0000
- Revision:
- 5:889ad974b64d
- Parent:
- 1:3bdadf6f6dbd
- Child:
- 6:a1a7dc264fed
Code after new enemy class but before combining draw functions
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ozy | 1:3bdadf6f6dbd | 1 | #ifndef ENEMY_H |
ozy | 1:3bdadf6f6dbd | 2 | #define ENEMY_H |
ozy | 1:3bdadf6f6dbd | 3 | |
ozy | 1:3bdadf6f6dbd | 4 | #include "mbed.h" |
ozy | 1:3bdadf6f6dbd | 5 | #include "N5110.h" |
ozy | 1:3bdadf6f6dbd | 6 | |
ozy | 1:3bdadf6f6dbd | 7 | class Enemy |
ozy | 1:3bdadf6f6dbd | 8 | { |
ozy | 1:3bdadf6f6dbd | 9 | public: |
ozy | 1:3bdadf6f6dbd | 10 | Enemy(); // constructor |
ozy | 5:889ad974b64d | 11 | int get_x(); // get x co-ordinate |
ozy | 5:889ad974b64d | 12 | int get_y(); // get y co-ordinate |
ozy | 5:889ad974b64d | 13 | void set_x(int x); // set x co-ordinate |
ozy | 5:889ad974b64d | 14 | void set_y(int y); // set y co-ordinate |
ozy | 5:889ad974b64d | 15 | void add_x(int x); // add to the x co-ordinate |
ozy | 5:889ad974b64d | 16 | void add_y(int y); // add to the y co-ordinate |
ozy | 5:889ad974b64d | 17 | |
ozy | 5:889ad974b64d | 18 | void draw(N5110 &lcd); |
ozy | 5:889ad974b64d | 19 | void move_right(N5110 &lcd); // print move right animation |
ozy | 5:889ad974b64d | 20 | void move_left(N5110 &lcd); // print move left animation |
ozy | 5:889ad974b64d | 21 | void move_right2(N5110 &lcd); // 2nd move right animation to move legs |
ozy | 5:889ad974b64d | 22 | void move_left2(N5110 &lcd); // 2nd move left animation to move legs |
ozy | 5:889ad974b64d | 23 | void kick_right(N5110 &lcd); // enemy kick right |
ozy | 5:889ad974b64d | 24 | void kick_left(N5110 &lcd); // enemy kick left |
ozy | 5:889ad974b64d | 25 | void sword_left(N5110 &lcd); // enemy punch left |
ozy | 5:889ad974b64d | 26 | void sword_right(N5110 &lcd); // enemy punch right |
ozy | 5:889ad974b64d | 27 | |
ozy | 5:889ad974b64d | 28 | private: |
ozy | 5:889ad974b64d | 29 | int _x, _y; // co-ordinates of the enemy |
ozy | 1:3bdadf6f6dbd | 30 | }; |
ozy | 1:3bdadf6f6dbd | 31 | |
ozy | 1:3bdadf6f6dbd | 32 | #endif |