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:
- 7:2e37bad816cb
- Parent:
- 6:a54df561f442
- Child:
- 9:3a7776a29a11
--- a/Game/Game.cpp Thu Mar 14 12:08:10 2019 +0000 +++ b/Game/Game.cpp Fri Mar 15 07:55:23 2019 +0000 @@ -2,7 +2,9 @@ #include "Input.h" Game::Game() { - + currentTetromino = Tetromino::getTetrominoOfType( + Tetromino::getRandomTetrominoType()); + nextTetrominoType = Tetromino::getRandomTetrominoType(); } Game::~Game() { @@ -15,23 +17,27 @@ void Game::update() { if (false /* Input::getLeft */) { - if (grid.isSpaceForTetromino(currentTetromino.movedLeft()) { + if (grid.isSpaceForTetromino(currentTetromino.movedLeft())) { currentTetromino = currentTetromino.movedLeft(); } } } -void MoveCurrentTetrominoDown() { - if (grid.isSpaceForTetrimino(currentTetromino.movedDown()) { +void Game::moveCurrentTetrominoDown() { + if (grid.isSpaceForTetromino(currentTetromino.movedDown())) { currentTetromino = currentTetromino.movedDown(); } else { - grid::placeTetromino(currentTetrimino); - currentTetrimino = Tetrimino(); + grid.placeTetromino(currentTetromino); + currentTetromino = Tetromino::getTetrominoOfType(nextTetrominoType); } } +void Game::dropCurrentTetromino() { + +} + void Game::draw() { - currentTetrimino.draw(); + currentTetromino.draw(); grid.draw(); }