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
Fork of el17ajf by
Diff: Game/Game.cpp
- Revision:
- 17:cc448ab7266f
- Parent:
- 15:afeefa3ceb61
- Child:
- 18:24ce897024d0
--- a/Game/Game.cpp Tue Mar 26 10:18:17 2019 +0000 +++ b/Game/Game.cpp Wed Apr 03 13:37:56 2019 +0000 @@ -1,6 +1,6 @@ #include "Game.h" #include "Input.h" -#include "mbed.h" // TODO +#include "Menus.h" /* BUGS: * @@ -9,11 +9,23 @@ * */ -Game::Game() { +Game::Game(Difficulty difficulty) { currentTetromino = Tetromino::getTetrominoOfType( Tetromino::getRandomTetrominoType()); nextTetrominoType = Tetromino::getRandomTetrominoType(); - move_frames = 3; + + switch (difficulty) { + case EASY: + move_frames = 8; + break; + case MEDIUM: + move_frames = 6; + break; + case HARD: + move_frames = 3; + break; + } + frames = 0; last_move_frame = 0; start_x = Grid::GRID_WIDTH / 2 - 1; @@ -81,5 +93,5 @@ } void Game::gameOver() { - // TODO + Menus::add(Menus::GAME_OVER); }