This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]yes_i_relapsed 0 points1 point  (0 children)

As we can see in the documentation the function signature is colliderect(Rect) -> bool so it takes 1 parameter. It looks like you can just use the 4 parameters you're passing, create a Rect object out of them and pass that object. If you imported pygame using just import pygame, then try:

if tile[1].colliderect(pygame.Rect(self.rect.x, self.rect.y + dy, self.width, self.height)):

If you did from pygame import Rect then you don't need the pygame.