💥
The Big Crash
A game isn’t a game if you can’t lose! We need to detect Collisions. If the bird’s rectangle touches a pipe’s rectangle… GAME OVER!
Collision Check
Use Pygame’s built-in box checking to see if things overlap.
🎯
🎯
Level Goal
Use colliderect to detect if the bird hits a pipe and ends the game.
Logic Lab: python.py
0/3
123456789
def check_collision(pipes):
for pipe in pipes:
if bird_rect.(pipe):
return
if bird_rect.top <= 0 or bird_rect.bottom >= 900:
return
return True