🎮Collision Detection
Also known as Collision, Collisions, Collision Checking
How a game finds out that two things are touching.
Think of it like
Think of it like playing tag. The game keeps asking who touched whom.
Example
In Jack's game, a coin vanishes when the player's box overlaps the coin's box.
Why it matters
Nearly every game rule needs it: walls, hits, pickups and floors.
Definition
Example code
python
def overlap(a, b):
return (a.x < b.x + b.w and b.x < a.x + a.w and
a.y < b.y + b.h and b.y < a.y + a.h)Common mistake
Key takeaways
- 1Check each frame. The test runs on every pass of the loop.
- 2Simple shapes. Boxes and circles are fast to test.
- 3Then react. The game decides what a touch means.