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@26:d16a5b1e0ace, 2019-05-08 (annotated)
- Committer:
- el17m2h
- Date:
- Wed May 08 17:24:35 2019 +0000
- Revision:
- 26:d16a5b1e0ace
- Parent:
- 24:67dc71a8f009
- Child:
- 29:15e9640646b7
Added comments for the documentation file.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17m2h | 20:a359092079b0 | 1 | #ifndef ENEMY_H |
el17m2h | 20:a359092079b0 | 2 | #define ENEMY_H |
el17m2h | 20:a359092079b0 | 3 | |
el17m2h | 20:a359092079b0 | 4 | #include "mbed.h" |
el17m2h | 20:a359092079b0 | 5 | #include "N5110.h" |
el17m2h | 20:a359092079b0 | 6 | #include "Gamepad.h" |
el17m2h | 20:a359092079b0 | 7 | #include "Bullet.h" |
el17m2h | 20:a359092079b0 | 8 | |
el17m2h | 24:67dc71a8f009 | 9 | /** Enemy class |
el17m2h | 24:67dc71a8f009 | 10 | @brief Class for the ghost enemies |
el17m2h | 24:67dc71a8f009 | 11 | @author Melissa Hartmann |
el17m2h | 24:67dc71a8f009 | 12 | @date May 2019 |
el17m2h | 24:67dc71a8f009 | 13 | */ |
el17m2h | 24:67dc71a8f009 | 14 | |
el17m2h | 20:a359092079b0 | 15 | class Enemy{ |
el17m2h | 20:a359092079b0 | 16 | public: |
el17m2h | 20:a359092079b0 | 17 | Enemy(); |
el17m2h | 20:a359092079b0 | 18 | ~Enemy(); |
el17m2h | 26:d16a5b1e0ace | 19 | /** |
el17m2h | 26:d16a5b1e0ace | 20 | @brief Defines the initial position of the enemy |
el17m2h | 26:d16a5b1e0ace | 21 | @param float position_x uses float since the velocity will be added, which is not an integer. |
el17m2h | 26:d16a5b1e0ace | 22 | @param float position_y uses float since the velocity will be added, which is not an integer. |
el17m2h | 26:d16a5b1e0ace | 23 | @param double velocity_y needs to be double in order for it to decelerate to a small value that |
el17m2h | 26:d16a5b1e0ace | 24 | approaches zero. |
el17m2h | 26:d16a5b1e0ace | 25 | @details The intial position of the doodler is at the centre of the screen and the values are |
el17m2h | 26:d16a5b1e0ace | 26 | gotten from the Engine class. It also defines the gravity as a positive vale greater than 1 |
el17m2h | 26:d16a5b1e0ace | 27 | and the up object as a negative vale less than 1. |
el17m2h | 26:d16a5b1e0ace | 28 | */ |
el17m2h | 20:a359092079b0 | 29 | void init(float floor_pos_x, float floor_pos_y); |
el17m2h | 20:a359092079b0 | 30 | void draw(N5110 &lcd); |
el17m2h | 20:a359092079b0 | 31 | void update(float floor_pos_x, float floor_pos_y); |
el17m2h | 20:a359092079b0 | 32 | Vector2D get_position(); |
el17m2h | 20:a359092079b0 | 33 | void set_position(Vector2D pos); // mutators |
el17m2h | 20:a359092079b0 | 34 | void set_score(int score); |
el17m2h | 20:a359092079b0 | 35 | |
el17m2h | 20:a359092079b0 | 36 | private: |
el17m2h | 22:0d2ac98a8b48 | 37 | Bullet b; |
el17m2h | 20:a359092079b0 | 38 | Vector2D _position; |
el17m2h | 20:a359092079b0 | 39 | float bullet_pos_y; |
el17m2h | 20:a359092079b0 | 40 | int _radius; |
el17m2h | 20:a359092079b0 | 41 | }; |
el17m2h | 20:a359092079b0 | 42 | #endif |