![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
All there but errors need fixing
Dependencies: mbed
Overview:
Rookie Tetris is a jigsaw style game based on the classic Tetris.
A block will appear at the top of the screen, you must move it (your options for movement are left, right and down - you cannot move up the board). The block will stop when it if placed either on the floor of the board or on-top of another block.
Your goal is to fill a complete row of the board with the blocks; when you do so the row will delete and the pattern above it will drop down. The game is over when your pattern is tall enough to reach to the top of the board!
Controls:
Use the joystick to move your block! Your block cannot move out of the parameters of the board.
Pot 2 controls the contrast of the screen.
Diff: TetrisGame/TetrisGame.cpp
- Revision:
- 8:cebb2aca8e19
- Parent:
- 6:39cbec524483
- Child:
- 9:58103274b2ab
diff -r 80e1c83b9b6a -r cebb2aca8e19 TetrisGame/TetrisGame.cpp --- a/TetrisGame/TetrisGame.cpp Mon Jun 01 13:31:37 2020 +0000 +++ b/TetrisGame/TetrisGame.cpp Mon Jun 01 16:39:13 2020 +0000 @@ -10,16 +10,16 @@ } -void TetrisGame::init(int x, int y, int height, int width, int speed) +void TetrisGame::init(int height, int width) { // initialise game parameters _height = height; _width = width; - _x = WIDTH/2 - _width/2; - _y = HEIGHT; - _speed = speed; +// _x = WIDTH/2 - _width/2; +// _y = HEIGHT; +// _speed = speed; - _tetromino.init(WIDTH/2 - 2, HEIGHT, 4, 4, _speed); // puts tetromino in middle SHOULD THIS INCLUDE ARRAY???? + _tetromino.init(_height, _width); // puts tetromino in middle SHOULD THIS INCLUDE ARRAY???? } @@ -71,7 +71,7 @@ lcd.drawRect(tetromino_pos.x, tetromino_pos.y, 4, 4, FILL_BLACK); - _tetromino.init(WIDTH/2 - 2, HEIGHT, 4, 4, _speed); // drop new shame + _tetromino.init(4, 4); // drop new shame } // check if hit roof @@ -103,7 +103,7 @@ lcd.drawRect(tetromino_pos.x, tetromino_pos.y, 4, 4, FILL_BLACK); - _tetromino.init(WIDTH/2 - 2, HEIGHT, 4, 4, _speed); // break to loop back or keep this ?? + _tetromino.init(4, 4); // break to loop back or keep this ?? } }