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@37:71f2cd073739, 2019-05-09 (annotated)
- Committer:
- el17m2h
- Date:
- Thu May 09 14:30:45 2019 +0000
- Revision:
- 37:71f2cd073739
- Parent:
- 29:15e9640646b7
Added comments to the enemy class documentation.
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 | |
el17m2h | 24:67dc71a8f009 | 8 | /** Enemy class |
el17m2h | 29:15e9640646b7 | 9 | @brief Class for the ghost enemies |
el17m2h | 24:67dc71a8f009 | 10 | @author Melissa Hartmann |
el17m2h | 24:67dc71a8f009 | 11 | @date May 2019 |
el17m2h | 24:67dc71a8f009 | 12 | */ |
el17m2h | 24:67dc71a8f009 | 13 | |
el17m2h | 29:15e9640646b7 | 14 | class Enemy |
el17m2h | 29:15e9640646b7 | 15 | { |
el17m2h | 20:a359092079b0 | 16 | public: |
el17m2h | 20:a359092079b0 | 17 | Enemy(); |
el17m2h | 20:a359092079b0 | 18 | ~Enemy(); |
el17m2h | 37:71f2cd073739 | 19 | |
el17m2h | 37:71f2cd073739 | 20 | /** |
el17m2h | 37:71f2cd073739 | 21 | @brief Function to set the enemy's position on top of the floor's position |
el17m2h | 37:71f2cd073739 | 22 | @param Vector2D floor_pos |
el17m2h | 37:71f2cd073739 | 23 | @details The function uses the parameters of the enemy and the floor's size to place the enemy on top of the floor. |
el17m2h | 37:71f2cd073739 | 24 | */ |
el17m2h | 29:15e9640646b7 | 25 | void update(Vector2D floor_pos); |
el17m2h | 37:71f2cd073739 | 26 | |
el17m2h | 37:71f2cd073739 | 27 | /** |
el17m2h | 37:71f2cd073739 | 28 | @brief Prints the enemy into the LCD screen |
el17m2h | 37:71f2cd073739 | 29 | @param N5110 &lcd |
el17m2h | 37:71f2cd073739 | 30 | @details The function draws a sprite of 12 x 12 bits that shows the image of the enemy ghost |
el17m2h | 37:71f2cd073739 | 31 | */ |
el17m2h | 20:a359092079b0 | 32 | void draw(N5110 &lcd); |
el17m2h | 37:71f2cd073739 | 33 | |
el17m2h | 37:71f2cd073739 | 34 | /** |
el17m2h | 37:71f2cd073739 | 35 | @brief Function to place the enemy at a position out of the screen's visibility |
el17m2h | 37:71f2cd073739 | 36 | @details The function draws sets the position of the enemy to a value where it will not be visible in the screen |
el17m2h | 37:71f2cd073739 | 37 | */ |
el17m2h | 29:15e9640646b7 | 38 | void erase(); |
el17m2h | 37:71f2cd073739 | 39 | |
el17m2h | 37:71f2cd073739 | 40 | /** |
el17m2h | 37:71f2cd073739 | 41 | @brief Returns the current enemy's position |
el17m2h | 37:71f2cd073739 | 42 | @details Gets the current value in the enemy's class for the enemy's position and returns it as a 2D vector |
el17m2h | 37:71f2cd073739 | 43 | */ |
el17m2h | 29:15e9640646b7 | 44 | Vector2D get_position(); |
el17m2h | 29:15e9640646b7 | 45 | |
el17m2h | 20:a359092079b0 | 46 | private: |
el17m2h | 20:a359092079b0 | 47 | Vector2D _position; |
el17m2h | 20:a359092079b0 | 48 | }; |
el17m2h | 20:a359092079b0 | 49 | #endif |