![](/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:
- 12:965b39a2e049
- Parent:
- 11:0183a52c1077
- Child:
- 13:600a34a047ca
diff -r 0183a52c1077 -r 965b39a2e049 TetrisGame/TetrisGame.cpp --- a/TetrisGame/TetrisGame.cpp Mon Jun 01 22:14:34 2020 +0000 +++ b/TetrisGame/TetrisGame.cpp Mon Jun 01 22:52:07 2020 +0000 @@ -101,10 +101,10 @@ Vector2D tetromino_velocity = _tetromino.get_velocity(); if ( - (lcd.getPixel(tetromino_pos.y + 4, tetromino_pos.x) == 1) || // not sure if it should be 4 or 5 ??? - (lcd.getPixel(tetromino_pos.y + 4, tetromino_pos.x + 1) == 1) || - (lcd.getPixel(tetromino_pos.y + 4, tetromino_pos.x + 2) == 1) || - (lcd.getPixel(tetromino_pos.y + 4, tetromino_pos.x + 3) == 1) + (lcd.getPixel(tetromino_pos.x, tetromino_pos.y + 4) == 1) || // not sure if it should be 4 or 5 ??? + (lcd.getPixel(tetromino_pos.x + 1, tetromino_pos.y + 4) == 1) || + (lcd.getPixel(tetromino_pos.x + 2, tetromino_pos.y + 4) == 1) || + (lcd.getPixel(tetromino_pos.x + 3, tetromino_pos.y + 4) == 1) ) { tetromino_velocity.x = 0; @@ -135,11 +135,13 @@ if(count==83) { count = 0; lcd.drawLine(0,j,82,j,0); // clear line + printf("line canceled!\n"); // score++; for(int x=0; x<=82; x++) { for(int y=j; y>=0; y--) { lcd.setPixel(x,y,false); lcd.setPixel(x,y+1); + printf("line dropped!\n"); } } } @@ -153,8 +155,10 @@ lcd.printString(" GAME OVER ",0, 3); lcd.refresh(); wait(10); + printf("game over!\n"); lcd.clear(); lcd.printString(" press RESET ",0,6); lcd.refresh(); + printf("press reset!\n"); exit(1.0); }