Home

Published

- 1 min read

how to do collision detection in pygame

img of how to do collision detection in pygame

The solution for this is noted below

how to do collision detection in pygame

Solution

   #making stuff to collide
player=pygame.Rect(whatever you want)
villian=pygame.Rect(whatever you want)

#making the detection
if villian.colliderect(player):
	print ("villian got you oh no!")#this can be something different

Try other methods by searching on the site. That is if this doesn’t work