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:
- 26:d16a5b1e0ace
- Parent:
- 24:67dc71a8f009
- Child:
- 29:15e9640646b7
--- a/Floors/Floors.h Wed May 08 15:07:04 2019 +0000 +++ b/Floors/Floors.h Wed May 08 17:24:35 2019 +0000 @@ -6,8 +6,8 @@ #include "Gamepad.h" #include "Enemy.h" -/** Floors class -@brief Class for the floors +/** Floor class +@brief Class for the floor @author Melissa Hartmann @date May 2019 */ @@ -17,42 +17,49 @@ ~Floors(); /** - @brief defines the initial position of the bullet - @param float dood_pos_x - @param float dood_pos_y - @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position) - */ + @brief Defines the initial position of the floor, its width and height + @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. + */ void init(int y, int width, int height); /** - @brief defines the initial position of the bullet - @param float dood_pos_x - @param float dood_pos_y - @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position) + @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 defines the initial position of the bullet - @param float dood_pos_x - @param float dood_pos_y - @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position) + @brief Updates the position of the floor + @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 + 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. */ void update(float doodler_pos_y); /** - @brief defines the initial position of the bullet - @param float dood_pos_x - @param float dood_pos_y - @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's position) + @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(); - /** - @brief defines the initial position of the bullet - @param float dood_pos_x - @param float dood_pos_y - @details The intial position is in same position as doodler's trunk end (which is why I am adding the 12 and 4 to the doodler's 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 + vector parameter to the function. */ void set_position(Vector2D pos); // mutators