All there but errors need fixing

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
el18rs
Date:
Sun May 31 17:35:30 2020 +0000
Parent:
4:7ddd287a5d28
Commit message:
changes made

Changed in this revision

TetrisGame/TetrisGame.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 7ddd287a5d28 -r 53e021832adc TetrisGame/TetrisGame.cpp
--- a/TetrisGame/TetrisGame.cpp	Sun May 31 17:01:53 2020 +0000
+++ b/TetrisGame/TetrisGame.cpp	Sun May 31 17:35:30 2020 +0000
@@ -86,3 +86,25 @@
  // update tetromino parameters??   
 }
 
+void check_tetromino_collisions(Tetromino tetromino)
+{
+    Vector2D tetromino_pos = _tetromino.get_pos();
+    Vector2D tetromino_velocity = _tetromino.get_velocity();
+
+    if (
+    (lcd.get_pixel(tetromino_pos.y + 4, tetromino_pos.x) = 1) || // not sure if it should be 4 or 5 ??? 
+    (lcd.get_pixel(tetromino_pos.y + 4, tetromino_pos.x + 1) = 1) || 
+    (lcd.get_pixel(tetromino_pos.y + 4, tetromino_pos.x + 2) = 1) ||
+    (lcd.get_pixel(tetromino_pos.y + 4, tetromino_pos.x + 3) = 1)
+    ) {
+        tetromino_velocity.x = 0;
+        
+        pad.tone(1000.0,0.1);
+        cancel_line();
+        
+        blocknumber ++ 
+        if (blocknumber > 4) { blocknumber = 0; }
+            
+        _tetromino.init(_number, WIDTH/2 - 2, HEIGHT, _speed); // break to loop back or keep this ??
+        
+}
diff -r 7ddd287a5d28 -r 53e021832adc main.cpp
--- a/main.cpp	Sun May 31 17:01:53 2020 +0000
+++ b/main.cpp	Sun May 31 17:35:30 2020 +0000
@@ -146,26 +146,3 @@
         wait(0.1);
     }
 }
-
-void check_tetromino_collisions()
-{
-    Vector2D tetromino_pos = _tetromino.get_pos();
-    Vector2D tetromino_velocity = _tetromino.get_velocity();
-
-    if (
-    (lcd.get_pixel(tetromino_pos.y + 4, tetromino_pos.x) = 1) || // not sure if it should be 4 or 5 ??? 
-    (lcd.get_pixel(tetromino_pos.y + 4, tetromino_pos.x + 1) = 1) || 
-    (lcd.get_pixel(tetromino_pos.y + 4, tetromino_pos.x + 2) = 1) ||
-    (lcd.get_pixel(tetromino_pos.y + 4, tetromino_pos.x + 3) = 1)
-    ) {
-        tetromino_velocity.x = 0;
-        
-        pad.tone(1000.0,0.1);
-        cancel_line();
-        
-        blocknumber ++ 
-        if (blocknumber > 4) { blocknumber = 0; }
-            
-        _tetromino.init(_number, WIDTH/2 - 2, HEIGHT, _speed); // break to loop back or keep this ??
-        
-}