![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
All there but errors need fixing
Diff: TetrisGame/TetrisGame.cpp
- Revision:
- 5:53e021832adc
- Parent:
- 4:7ddd287a5d28
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 ?? + +}