ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Revision:
32:83f410c433c2
Parent:
29:15e9640646b7
Child:
34:a9b14a4ccd46
diff -r 5c4acae51026 -r 83f410c433c2 Doodler/Doodler.h
--- a/Doodler/Doodler.h	Thu May 09 10:15:20 2019 +0000
+++ b/Doodler/Doodler.h	Thu May 09 11:21:53 2019 +0000
@@ -41,11 +41,33 @@
     or not.
     @param float mag is used to accelerate the movement of the doodler in the x-direction since it
     moves 5 frames * the magnitude of the joystick.
-    @details The function checks the doodler does not leave the screen rectangle (30 x 83) in the
-    x-direction and checks the direction of the velocity to keep adding or substructing a value in
-    the y-direction (depending on if it is jumping or falling)
+    @details The function calls both the x-coordinate position update function and y-coordinate position update function.
     */
     void update(Direction d, float mag);
+    
+    /**
+    @brief Updates the x-coordinate position of the doodler
+    @param Direction d is gotten from the user input of the joystick and determines the movement of
+    the doodler in the x-direction. It moves left/right if the joystick directs left/right at an angle
+    or not.
+    @param float mag is used to accelerate the movement of the doodler in the x-direction since it
+    moves 5 frames * the magnitude of the joystick.
+    @details It reads the input movement of joystick and defines the velocity_x as a variable dependent on the magnitude 
+    of inclination read, so that the velocity changes accoordingly. It uses the direction input to decide in an if statement if the 
+    position_x should increase or decrease in value. It then checks the doodler does not leave the screen rectangle (39 x 82) in 
+    the x-direction by making it remain in the its position.
+    */
+    void update_x(Direction d, float mag);
+    
+    /**
+    @brief Updates the y-coordinate position of the doodler    
+    @details The function updates the y-coordinate position of the doodler. It has no input paramenters from the gamepad, 
+    since it only depends on the floors below it. It checks the direction of the velocity (dependent on the collision
+    with the floors) to check the direction of the doodler's movement (depending on if it is jumping or falling). It also 
+    checks the doodler remains within the y-coordinates of the screen (only top edge, because the bottom edge means the
+    game ends).
+    */
+    void update_y();
 
     /**
     @brief Function to check the doodler's y-coodinate velocity
@@ -109,7 +131,7 @@
     float _position_y;
     float _velocity_x;
     double _velocity_y;
-    double _gravity;
+    double _gravity; 
     double _up;
 };
 #endif
\ No newline at end of file