Mochu Yao explorer game
Dependencies: mbed
Diff: Gameengine/Gameengine.cpp
- Revision:
- 17:1b4ecc01b79f
- Parent:
- 9:e11bb7cef050
- Child:
- 19:14c5427b30d1
--- a/Gameengine/Gameengine.cpp Tue Apr 28 12:21:31 2020 +0000 +++ b/Gameengine/Gameengine.cpp Tue Apr 28 12:50:40 2020 +0000 @@ -96,7 +96,8 @@ void Gameengine::get_sprite() {_explorer_sprite = _player.get_explorer_sprite(); } void Gameengine::get_explorer_y(Gamepad &gamepad) { - if (_f_flag == true) + set_fall_flag(); + if (_f_flag == true) { _player.fall(_f_flag, gamepad); } else { @@ -108,7 +109,7 @@ void Gameengine::get_explorer_x() { _player_x = _player.get_x(); _speed = _player.get_speed(); - _player.set_x_coordinate(1, _speed, _player_direction); } + _player.set_x_coordinate(_coordinate.coord.x, _speed, _player_direction); } void Gameengine::update_lcd(N5110 &lcd) { lcd.drawSprite(_player_x,_player_y,10,10,(int *)_player.get_form(_explorer_sprite)); @@ -120,7 +121,7 @@ lcd.drawLine(line_5_value.left,line_5_value.y,line_5_value.right,line_5_value.y,FILL_BLACK); lcd.drawLine(line_6_value.left,line_6_value.y,line_6_value.right,line_6_value.y,FILL_BLACK); sprintf(buffer,"%2d",_player_score); - lcd.printString("score:",0,0); + lcd.printString("score",0,0); lcd.printString(buffer,30,0); } void Gameengine::run_engine(N5110 &lcd, Gamepad &gamepad) {