pygame check collision
def is_collided_with(self, sprite):
return self.rect.colliderect(sprite.rect)
pygame check collision
def is_collided_with(self, sprite):
return self.rect.colliderect(sprite.rect)
pygame collisions
player_rectangle = pygame.Rect(top, left, width, height)
player_rectangle.colliderect(rect_you_want_to_test_is_being_overlapped)
# Returns True or False if your rect collides with the rect given
player_rectangle.collidelist(list_of_rects)
# Tests if the player rect collides with a list of rects, returns index of
# rect, give -1 if no rect collides.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us