'Allows collisions only for the item closest to marios centerx'

def prevent_collision_conflict(self, obstacle1, obstacle2):

    if (obstacle1 and obstacle2):
        obstacle1_distance = (self.mario.rect.centerx - obstacle1.rect.centerx)
        if (obstacle1_distance < 0):
            obstacle1_distance *= (-1)
        obstacle2_distance = (self.mario.rect.centerx - obstacle2.rect.centerx)
        if (obstacle2_distance < 0):
            obstacle2_distance *= (-1)
        if (obstacle1_distance < obstacle2_distance):
            obstacle2 = False
        else:
            obstacle1 = False
    return (obstacle1, obstacle2)
