ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Revision:
13:10851784af9a
Parent:
12:c5123abb4fbe
Child:
14:529f798adae4
--- a/Doodler/Doodler.cpp	Wed Apr 17 17:53:27 2019 +0000
+++ b/Doodler/Doodler.cpp	Thu Apr 18 14:54:51 2019 +0000
@@ -18,10 +18,9 @@
     lcd.drawCircle(_pos_x, _pos_y, _radius, FILL_BLACK);
 }
 
-void Doodler::update(Direction d, float mag, float current_vel_x, double current_vel_y){
+void Doodler::update(Direction d, float mag){
 //////////////////////////// y - direction of doodler /////////////////////////////////////
-    _velocity_x = current_vel_x;
-    _velocity_y = (double)current_vel_y;
+    _velocity_y = (double)get_velocity_y(); 
     
     if ((double)_velocity_y >= 0.00){ // no jump 
         _pos_y += _velocity_y; 
@@ -30,7 +29,7 @@
         _velocity_y = -((double)_velocity_y * (double)_up); // jumps decelerating upwards (0<_up<1 so _velocity.y reaches 0)
         _pos_y += _velocity_y*5;
         
-        if (fabs((double)_velocity_y) < 0.005){ // decelerated completely
+        if (fabs((double)_velocity_y) < 0.008){ // decelerated completely
             _velocity_y = _gravity;
         }
     }