Mochu Yao explorer game
Dependencies: mbed
Diff: explorer/explorer.cpp
- Revision:
- 19:14c5427b30d1
- Parent:
- 17:1b4ecc01b79f
- Child:
- 20:20e6ba54e15c
--- a/explorer/explorer.cpp Tue Apr 28 12:52:16 2020 +0000 +++ b/explorer/explorer.cpp Tue Apr 28 13:37:26 2020 +0000 @@ -60,7 +60,7 @@ _player_direction = right; _r_flag = false; _speed = 0;//the player is standing at first - _jump_height = 15; + _jump_height = 0; } void Explorer::set_x_coordinate(float joy_x, int speed, Player_direction direction) @@ -147,21 +147,21 @@ } void Explorer::reset_flag(bool flag, Gamepad &gamepad) { - _r_flag = flag; - if (flag) { + if (flag) { _r_flag = true; } else { _r_flag = false; } +} + gamepad.tone(600, 0.05); } 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 - _y--; } - else if(_y == -80) { // Stop falling function + _y++; + if(_y == 80) { // Stop falling function _f_flag = false; _r_flag = true; gamepad.tone(1000, 0.05);