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
Enemy/Enemy.h@1:3916f272663e, 2019-04-21 (annotated)
- Committer:
- adat80
- Date:
- Sun Apr 21 19:02:21 2019 +0000
- Revision:
- 1:3916f272663e
- Child:
- 2:88019d96e1da
Program with working spawning of enemies and killing of enemies;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| adat80 | 1:3916f272663e | 1 | #ifndef ENEMY_H |
| adat80 | 1:3916f272663e | 2 | #define ENEMY_H |
| adat80 | 1:3916f272663e | 3 | |
| adat80 | 1:3916f272663e | 4 | #include "mbed.h" |
| adat80 | 1:3916f272663e | 5 | #include "N5110.h" |
| adat80 | 1:3916f272663e | 6 | #include "Gamepad.h" |
| adat80 | 1:3916f272663e | 7 | #include <time.h> |
| adat80 | 1:3916f272663e | 8 | |
| adat80 | 1:3916f272663e | 9 | |
| adat80 | 1:3916f272663e | 10 | /** CrossHairs Class |
| adat80 | 1:3916f272663e | 11 | @author Adam Jones, University of Leeds |
| adat80 | 1:3916f272663e | 12 | @brief Controls the Enemy Sprites in the Wall Defence game |
| adat80 | 1:3916f272663e | 13 | @date April 2017 |
| adat80 | 1:3916f272663e | 14 | */ |
| adat80 | 1:3916f272663e | 15 | class Enemy |
| adat80 | 1:3916f272663e | 16 | { |
| adat80 | 1:3916f272663e | 17 | |
| adat80 | 1:3916f272663e | 18 | public: |
| adat80 | 1:3916f272663e | 19 | Enemy(); |
| adat80 | 1:3916f272663e | 20 | ~Enemy(); |
| adat80 | 1:3916f272663e | 21 | void init(float timeToAttack); |
| adat80 | 1:3916f272663e | 22 | void draw(N5110 &lcd); |
| adat80 | 1:3916f272663e | 23 | void update(); |
| adat80 | 1:3916f272663e | 24 | /// accessors and mutators |
| adat80 | 1:3916f272663e | 25 | Vector2D get_pos(); |
| adat80 | 1:3916f272663e | 26 | void set_pos(Vector2D p); |
| adat80 | 1:3916f272663e | 27 | void set_attack(bool attack); |
| adat80 | 1:3916f272663e | 28 | float get_timeToAttack(); |
| adat80 | 1:3916f272663e | 29 | |
| adat80 | 1:3916f272663e | 30 | void set_alive(bool alive); |
| adat80 | 1:3916f272663e | 31 | bool get_alive(); |
| adat80 | 1:3916f272663e | 32 | private: |
| adat80 | 1:3916f272663e | 33 | |
| adat80 | 1:3916f272663e | 34 | int _x; |
| adat80 | 1:3916f272663e | 35 | int _y; |
| adat80 | 1:3916f272663e | 36 | bool _attack; |
| adat80 | 1:3916f272663e | 37 | bool _alive; |
| adat80 | 1:3916f272663e | 38 | float _timeToAttack; |
| adat80 | 1:3916f272663e | 39 | }; |
| adat80 | 1:3916f272663e | 40 | #endif |