Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: EngineController/EngineController.cpp
- Revision:
- 17:f377df4ea7b1
- Parent:
- 16:331be5c7ed80
- Child:
- 18:304700b5d8f8
--- a/EngineController/EngineController.cpp Wed Apr 10 13:40:58 2019 +0000 +++ b/EngineController/EngineController.cpp Thu Apr 11 11:37:49 2019 +0000 @@ -24,23 +24,27 @@ // Initialise the game engine, game counter and starting text flag. _game_engine.init(); _game_counter = 0; + _speed_divider = 10; _start_platform = true; + _change_speed_flag = false; } void EngineController::run_game_engine(N5110 &lcd, Gamepad &gamepad) { // The main game loop that first checks if the game has just started and runs // the game. check_for_start(lcd); + if(_game_counter == 100) _game_counter = 0; update_game(lcd, gamepad); - if(_game_counter == 100) _game_counter = 0; - if (_game_counter % 10 == 0) _game_engine.generate_level(); + if (_game_counter % _speed_divider == 0) _game_engine.generate_level(_game_counter); _game_counter++; + _player_score = _game_engine.get_player_score(); + _speed_divider = int(-0.25*_player_score + 10); } void EngineController::check_for_start(N5110 &lcd) { // Print the intro text if the game has just started. if(_start_platform) print_intro_text(lcd); - _game_engine.check_reset(); + _game_engine.check_reset(lcd); _start_platform = _game_engine.get_start_platform(); }