Why isn't my player/tile collision working?
From looking at usages, collidelist
and collidelistall
seem to take two parameters: a Rect
and a list. collidelist
returns the first index in the list which the Rect
collides with, or -1
if there are no collisions. collidelistall
returns a list of all the Rect
s which collided. So the line
elif player != pygame.Rect.collidelistall(cell_rects):
should instead be
elif pygame.Rect.collidelist(player, cell_rects) == -1: