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.

Revision:
16:fca1bbb06c44
Parent:
15:68114eae4053
Child:
17:70d45e9e44a8
diff -r 68114eae4053 -r fca1bbb06c44 TetrisGame/TetrisGame.cpp
--- a/TetrisGame/TetrisGame.cpp	Tue Jun 02 21:07:17 2020 +0000
+++ b/TetrisGame/TetrisGame.cpp	Tue Jun 02 21:22:20 2020 +0000
@@ -109,10 +109,10 @@
     Vector2D tetromino_velocity = _tetromino.get_velocity();
 
     if (
-        (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)
+        (lcd.getPixel(tetromino_pos.x, tetromino_pos.y + 5) == 1) || // not sure if it should be 4 or 5 ???
+        (lcd.getPixel(tetromino_pos.x + 1, tetromino_pos.y + 5) == 1) ||
+        (lcd.getPixel(tetromino_pos.x + 2, tetromino_pos.y + 5) == 1) ||
+        (lcd.getPixel(tetromino_pos.x + 3, tetromino_pos.y + 5) == 1)
     ) {
         tetromino_velocity.x = 0;
 
@@ -122,6 +122,11 @@
 //        lcd.drawRect(tetromino_pos.x, tetromino_pos.y, 4, 4, FILL_BLACK);
 
         _tetromino.init(_px, _py); // break to loop back or keep this ??
+        
+        a = tetromino_pos.x;
+        b = tetromino_pos.y;
+
+        floor_hit_flag = 1;
 
         printf("blocks stacked!\n");
     }
@@ -177,7 +182,7 @@
     for (int i=0; i<=iH; i++) {
         x0 = X[i];
         y0 = Y[i];
-        lcd.drawRect(x0, y0, x0 + 4, y0 + 4, FILL_BLACK);
+        lcd.drawRect(x0, y0, 4, 4, FILL_BLACK);
         printf("block drawn\n");
     }
 }
\ No newline at end of file