Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed N5110 ShiftReg Joystick
Enemy.h@16:4a1d916d97c5, 2021-04-27 (annotated)
- Committer:
- ozy
- Date:
- Tue Apr 27 22:46:33 2021 +0000
- Revision:
- 16:4a1d916d97c5
- Parent:
- 15:7fd2d34f3be5
Enemy collision success
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 | 6:a1a7dc264fed | 7 | class Enemy |
| ozy | 1:3bdadf6f6dbd | 8 | { |
| ozy | 1:3bdadf6f6dbd | 9 | public: |
| ozy | 6:a1a7dc264fed | 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 | 14:7f23841685ad | 13 | void init(); |
| ozy | 5:889ad974b64d | 14 | void set_x(int x); // set x co-ordinate |
| ozy | 5:889ad974b64d | 15 | void set_y(int y); // set y co-ordinate |
| ozy | 5:889ad974b64d | 16 | void add_x(int x); // add to the x co-ordinate |
| ozy | 5:889ad974b64d | 17 | void add_y(int y); // add to the y co-ordinate |
| ozy | 6:a1a7dc264fed | 18 | |
| ozy | 8:e2e2eb4ea0ca | 19 | void draw(N5110 &lcd, int input); |
| ozy | 5:889ad974b64d | 20 | void move_right(N5110 &lcd); // print move right animation |
| ozy | 5:889ad974b64d | 21 | void move_left(N5110 &lcd); // print move left animation |
| ozy | 6:a1a7dc264fed | 22 | void kick_right(N5110 &lcd); // enemy kick right |
| ozy | 6:a1a7dc264fed | 23 | void kick_left(N5110 &lcd); // enemy kick left |
| ozy | 6:a1a7dc264fed | 24 | void sword_left(N5110 &lcd); // enemy punch left |
| ozy | 6:a1a7dc264fed | 25 | void sword_right(N5110 &lcd); // enemy punch right |
| ozy | 12:b4477a312158 | 26 | void twoway_punch(N5110 &lcd); |
| ozy | 16:4a1d916d97c5 | 27 | int randomize_moves(N5110 &lcd, int input); |
| ozy | 12:b4477a312158 | 28 | void move_around(N5110 &lcd); |
| ozy | 6:a1a7dc264fed | 29 | |
| ozy | 5:889ad974b64d | 30 | private: |
| ozy | 5:889ad974b64d | 31 | int _x, _y; // co-ordinates of the enemy |
| ozy | 1:3bdadf6f6dbd | 32 | }; |
| ozy | 1:3bdadf6f6dbd | 33 | |
| ozy | 6:a1a7dc264fed | 34 | #endif |