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
Diff: Floors/Floors.h
- Revision:
- 29:15e9640646b7
- Parent:
- 26:d16a5b1e0ace
- Child:
- 31:5c4acae51026
--- a/Floors/Floors.h Wed May 08 18:02:11 2019 +0000 +++ b/Floors/Floors.h Wed May 08 21:11:35 2019 +0000 @@ -11,64 +11,72 @@ @author Melissa Hartmann @date May 2019 */ -class Floors{ +class Floors +{ public: Floors(); ~Floors(); - - /** + + /** @brief Defines the initial position of the floor, its width and height - @param int y - @param int width + @param int y + @param int width @param int height - @details The x-coordinate is initially random and excludes the space 30-40 so that the doodler falls - to a floor that is set to be at the bottom center (instead of a random position) in the engine cpp - (to make sure there is always a stating point position for the doodler). This is done by using a - decision object to choose which randomly generated x-coordinate position the doodler will have - (either at the left side or the right side). The y-coordinate position is inputed from the engine - cpp and kept the same. - */ + @details The x-coordinate is initially random and excludes the space 30-40 so that the doodler falls + to a floor that is set to be at the bottom center (instead of a random position) in the engine cpp + (to make sure there is always a stating point position for the doodler). This is done by using a + decision object to choose which randomly generated x-coordinate position the doodler will have + (either at the left side or the right side). The y-coordinate position is inputed from the engine + cpp and kept the same. + */ void init(int y, int width, int height); - - /** + + /** @brief Prints the floor into the LCD screen @param N5110 &lcd @details The function draws a 14 x 1 rectangle */ void draw(N5110 &lcd); - - /** + + /** @brief Updates the position of the floor - @param float doodler_pos_y is inputed into the function to decides if the floor should move + @param float doodler_pos_y is inputed into the function to decides if the floor should move or remain at its position. - @details The function first checks if the position should change, which occurs if the doodler's position is above - the middle of the screen's height (x-coordinate less than 25). If it is so, the floor will shift downwards (add 1 to + @details The function first checks if the position should change, which occurs if the doodler's position is above + the middle of the screen's height (x-coordinate less than 25). If it is so, the floor will shift downwards (add 1 to the y-coordinate). The function then checks if the floor has reached the bottom of the screen (y-coordinate over 45) - and if so, the floor will re-appear at the top of the screen (y-coordinate = 9) and at a random x-coordinate position, - making there be 6 floors always on the screen. + and if so, the floor will re-appear at the top of the screen (y-coordinate = 9) and at a random x-coordinate position, + making there be 6 floors always on the screen. */ - void update(float doodler_pos_y); + void update(float doodler_pos_x, float doodler_pos_y, float _bullet_pos_x, float _bullet_pos_y); + - /** + void check_enemy(float _bullet_pos_x, float _bullet_pos_y); + + /** @brief Returns the current floor's position as a vector @details Gets the current value in the floor's class for the position */ - Vector2D get_position(); - + Vector2D get_position(); + /** @brief Sets the floor's position in the Floor's class to equal the inputed vector parameter @param Vector2D pos is inputed to define the new position - @details The function sets the floor's position by making the current position equal the inputed + @details The function sets the floor's position by making the current position equal the inputed vector parameter to the function. */ void set_position(Vector2D pos); // mutators - + private: int _height; int _width; Vector2D _position; - Enemy _eny; + Enemy eny; + bool put_enemy; + Vector2D enemy_position; int place; - + float _doodler_pos_x; + float _doodler_pos_y; + }; #endif \ No newline at end of file