ELEC2645 (2018/19) / Mbed 2 deprecated el17lw

Dependencies:   mbed

Revision:
18:304700b5d8f8
Parent:
14:9861fe85c803
Child:
20:a8cad4e044ea
--- a/Skateboarder/Stakeboarder.cpp	Thu Apr 11 11:37:49 2019 +0000
+++ b/Skateboarder/Stakeboarder.cpp	Fri Apr 12 11:30:25 2019 +0000
@@ -142,11 +142,11 @@
   // Sets the value of the Sprite_value enum according to joystick direction 
   // and previous direction if the joystick is not moving. Adds or subtracts
   // one from moving counter for horizontal movement. 
-  if (joy_x > 0.1) {
+  if (joy_x > float(0.1)) {
     _moving_counter = _moving_counter++;
     _skate_direction = Right;
     _sprite_value = Skate_right;
-  } else if (joy_x < -0.1) {
+  } else if (joy_x < float(-0.1)) {
     _moving_counter = _moving_counter--;
     _skate_direction = Left;
     _sprite_value = Skate_left; 
@@ -170,10 +170,10 @@
 void Skateboarder::set_y_position(bool jump, int jump_counter, int level_condition) {
   _jump_counter = jump_counter;
   _level_condition = level_condition; 
-  // Set jump counter to 40 if button is pressed. Second condition is to restrict 
+  // Set jump counter to 40 if button is pressed, jump counter condition is to restrict 
   // double jump. Keep subtracting jump counter from default y position, subtracting
   // one from the jump counter on every iteration until it is equal to 0.
-  if (jump && _jump_counter < 10) _jump_counter = 40;
+  if (jump && _jump_counter < 15) _jump_counter = 40;
   if (_jump_counter !=0) _jump_counter--;        
   if(_level_condition == 1 && jump){
     _level = 5;