

def detectXCollisions(self, controllingEntity):
    block_hit_list = pygame.sprite.spritecollide(controllingEntity, self.entities, False)
    collisionDetected = False
    for block in block_hit_list:
        collisionDetected = True
        if (controllingEntity.deltaX > 0):
            controllingEntity.rect.right = block.rect.left
        else:
            controllingEntity.rect.left = block.rect.right
    return collisionDetected

dataset/ETHPy150Open maximx1/PyPlatformerEngine/pyplatformerengine/physics/BasicCollisionDetection.py BasicCollisionDetection.detectXCollisions/original