Я пытаюсь сделать так, чтобы, когда игрок, созданный с помощью pygame.draw.rect, пытался пройти сквозь стены1 без выполнения первого вызова, он отправлялся в координаты (600, 600), AKA где они начали с. Прямо сейчас, когда я запускаю код ниже, это делают только углы wall1. Спасибо!
walls1 = pygame.draw.lines(win, (100, 100, 100), False, [(screen_width - 100, screen_height),
(screen_width - 100, screen_height - 100),
(screen_width, screen_height - 100)], 5)
wall_dimentions = [(screen_width - 100, screen_height),
(screen_width - 100, screen_height - 100),
(screen_width, screen_height - 100)]
for b in range(100):
wall_dimentions.append((screen_width - b, screen_height))
wall_dimentions.append((screen_width, screen_height - b))
print(wall_dimentions)
for i in range(len(wall_dimentions)):
if isOver(player, wall_dimentions[i]):
player_pos_x = 600
player_pos_y = 600
isOver:
# checks if one object is over another object in a GUI
def isOver(self, pos):
if pos[0] > self.x and pos[0] < self.x + self.width:
if pos[1] > self.y and pos[1] < self.y + self.height:
return True