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:
6:39cbec524483
Parent:
5:53e021832adc
Child:
7:80e1c83b9b6a
diff -r 53e021832adc -r 39cbec524483 main.cpp
--- a/main.cpp	Sun May 31 17:35:30 2020 +0000
+++ b/main.cpp	Sun May 31 20:41:41 2020 +0000
@@ -42,8 +42,6 @@
 void update_game(UserInput input);
 void render();
 void welcome();
-void exit_game();
-void cancel_line();
 int score = 0;
 
 // int ScreenHeight = 84;
@@ -64,7 +62,7 @@
 // game loop
     while(1) {
         tetris.read_input(pad); // read input 
-        tetris.update(pad);
+        tetris.update(pad, lcd);
         //play_game(); // update game state 
         render(); // render the display
         wait(1.0f/fps); // wait one frame period 
@@ -72,45 +70,6 @@
         
 }
 }
-        
-void exit_game() {
-     lcd.clear();
-     lcd.printString(" GAME OVER ",0, 3);
-     lcd.refresh();
-     wait(10);
-     lcd.clear();
-     lcd.printString(" press RESET ",0,6);
-     lcd.refresh();
-     exit(1.0);
-}  
-
-    
-void cancel_line() {
-        int count;
-    for(int j=0; j<=46; j+=1) {
-    for(int i=0; i<=82; i++) {
-        if (lcd.getPixel(i,j)==0) {
-            count=0;
-            break;
-        } else if (lcd.getPixel(i,j)==1){
-            count ++;
-              }
-            }
-        if(count==83) {
-            count = 0;
-            lcd.drawLine(0,j,82,j,0); // clear line
-            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);
-                    }
-                }
-            }
-        }
-    
-
-}
 
 
 // initialise classes and libraries
@@ -119,7 +78,7 @@
     pad.init(); // initialise Gamepad
     
     // initialise the game with correct tetromino sizes etc
-    tetris.init(0, WIDTH/2 - 2, HEIGHT, 1);
+    tetris.init(WIDTH/2 - 2, HEIGHT, 4, 4, 1);
     
 }