0

I am trying to make two sprites collide with each other using masks but I don't know which command to use. I searched the internet but no one seemed to look for the same answers as me. -I am using sprites -I need the sprites representing the wall to run trough a for loop so that when I know it collided with my player I can do things with that specific tile Read the code below for some more details on what I want to do:

player = self.player.sprite # player class inherited from pygame.sprite.Sprite GroupSingle

        for sprite in self.tiles.sprites(): # tile class inherited from pygame.sprite.Sprite Group
            if sprite.rect.colliderect(player.rect): # This is the line that I would like to change for mask support
                if player.direction.x > 0:
                    player.rect.right = sprite.rect.left
                if player.direction.x < 0:
                    player.rect.left = sprite.rect.right

0 Answers0