explorer game

Dependencies:   mbed

Revision:
7:88c4ba6bb37b
Parent:
3:672d4bd8225d
Child:
8:201ef0618b7d
diff -r 8d3c09108024 -r 88c4ba6bb37b explorer/explorer.cpp
--- a/explorer/explorer.cpp	Wed Apr 22 04:04:08 2020 +0000
+++ b/explorer/explorer.cpp	Thu Apr 23 07:49:39 2020 +0000
@@ -61,19 +61,19 @@
   //this process is to set x and make sure the player can move          
   _player_direction = direction;
   _speed = speed;
-  if (joystick_x < float(-0.5)) {
+  if (joy_x < float(-0.5)) {
     _speed = _speed--;//
     _player_direction = left;
-    _sprite = Move_left;//makesure the value is the Move_left value in the enum 
+    _explorer_sprite = Move_left;//makesure the value is the Move_left value in the enum 
   //now x is moving to the right than add to the X position
-  } else if (joystick_x > float(0.5)) {
+  } else if (joy_x > float(0.5)) {
     _speed = _speed++;
     _player_direction = right; 
-    _sprite = Move_right;//makesure the value is the Move_right value in the enum  
+    _explorer_sprite = Move_right;//makesure the value is the Move_right value in the enum  
   } else if (_player_direction == right) {  
-    _sprite = Stand_right;// not moving so equals to enum Stand_right.
+    _explorer_sprite = Stand_right;// not moving so equals to enum Stand_right.
   } else { 
-    _sprite = Stand_left;//the least situation is equals to enum Stand_right.
+    _explorer_sprite = Stand_left;//the least situation is equals to enum Stand_right.
   }      
   _x = 0.5*_speed + 30;//this equation decides how fast the player move later I will update differnet modes to choose different speed
 }
@@ -94,8 +94,8 @@
   return _player_direction;
 }    
 
-explorer_sprite get_explorer_sprite(); {
-  return _sprite;
+explorer_sprite get_explorer_sprite() {
+  return _explorer_sprite;
 }
     
 void Explorer::set_y_coordinate(bool ifjump, int jump_height, int level) {
@@ -144,7 +144,7 @@
 void Explorer::fall(bool f_flag, Gamepad &gamepad) { 
   _f_flag = f_flag;
   if (f_flag == true) {
-    gamepad.tone(int(1500-0.5*_y), 0.05);  // decending equation 
+    gamepad.tone(int(1500+0.5*_y), 0.05);  // decending equation 
     _y--;
   else if(_y == -80) {  // Stop falling function 
     _f_flag = false;