ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Revision:
25:f122e1862cd1
Parent:
24:67dc71a8f009
Child:
26:d16a5b1e0ace
--- a/Doodler/Doodler.h	Wed May 08 14:24:53 2019 +0000
+++ b/Doodler/Doodler.h	Wed May 08 15:07:04 2019 +0000
@@ -40,16 +40,15 @@
     void update(Direction d, float mag);
     
     /** 
-    @brief Check velocity 
-    @details The function checks the velocity of the 
-    if ((double)_velocity_y > 0.00){ // no jump 
-        _velocity_y = (double)_velocity_y*(double)_gravity; // falls accelerating 
-    } else if ( (double)_velocity_y == 0.00){
-        _velocity_y = (double)_gravity; 
-    } else if ((double)_velocity_y < 0.00){ 
-        _velocity_y = -((double)_velocity_y * (double)_up); // jumps decelerating upwards (0<_up<1 so _velocity.y reaches 0)
-        if (fabs((double)_velocity_y) < 0.008){ // decelerated completely
-            _velocity_y = 0.00;
+    @brief Function to check the doodler's y-coodinate velocity 
+    @details The function checks the current velocity of the doodler and depending on 
+    its direction (positive or negative) it will decide if the doodler's updated velocity will remain the same or change direction (jump).
+    If the velocity is positive, it means it is currently jumping, so it should continue doing so but in a decreasing velocity (decelerating),
+    which is why it is multiplied times the _up constant (value less than 1). 
+    If the velocity is negative it means it is falling downwards and increasing in velocity (accelerating). This is done by multiplying the 
+    current velocity by the gravity constant value (greater than 1).
+    Finally, if the velocity is 0, it means it has completely decelerated upwards and so it should begin to fall. To do so, the velocity
+    is given the value of gravity (which is a positive value).
     */
     void check_velocity();  
     
@@ -78,18 +77,18 @@
     float get_position_y(); 
     
     /** 
-    @brief 
+    @brief Sets the doodler's velocity in the doodler's class to the parameters inputed
     @param float vel_x 
     @param float vel_y
-    @details 
+    @details The function sets the doodler's velocity in the doodler's class by making the current velocity equal to the parameters inputed to the function
     */
     void set_velocity(float vel_x, double vel_y);
     
-    /** 
-    @brief 
-    @param 
-    @param 
-    @details 
+    /**
+    @brief Sets the doodler's position in the doodler's class to the parameters inputed
+    @param float pos_x 
+    @param float pos_y
+    @details The function sets the doodler's position in the doodler's class by making the current position equal the parameters inputed to the function
     */
     void set_position(float pos_x, float pos_y);