Collision Detection

In this lesson, you will learn how to check for collisions to keep the Tetris pieces inside the game’s boundaries.

We'll cover the following...

Tetris would not be a particularly exciting game if all the blocks could pass through each other, or if the walls and floor did not stop them. So, instead of randomly moving the tetromino, we’ll check for potential collisions first, and we only move the tetromino if it’s safe. We have a few different collisions to consider.

We have a collision when the tetromino:

  • Hits the floor
  • Moves left or right into a wall
  • Hits a block on the board
...
Access this course and 1400+ top-rated courses and projects.