Jun-07-2019, 07:53 PM
I over looked that.
speed = 3 movement = pygame.Vector2(0, 0) # If the UP key is pressed, move the player upwards if pressed[pygame.K_UP] and not pressed[pygame.K_DOWN]: if char.y != 3: movement.y -= speed # If the DOWN key is pressed, move the player downwards if pressed[pygame.K_DOWN] and not pressed[pygame.K_UP]: if char.y != 279: movement.y += speed # If the LEFT key is pressed, move the player to the left if pressed[pygame.K_LEFT] and not pressed[pygame.K_RIGHT]: if char.x != minimum_x and not unlocked: movement.x -= speed # If the RIGHT key is pressed, move the player to the right if pressed[pygame.K_RIGHT] and not pressed[pygame.K_LEFT]: if char.x != 693: movement.x += speed if movement.x != 0 or movement.y != 0: moved = char.move(movement.x, movement.y) if moved.collidelist(fences) == -1: char = movedor
speed = 3 movement = pygame.Vector2(0, 0) # If the UP key is pressed, move the player upwards if pressed[pygame.K_UP] and not pressed[pygame.K_DOWN]: movement.y -= speed # If the DOWN key is pressed, move the player downwards if pressed[pygame.K_DOWN] and not pressed[pygame.K_UP]: movement.y += speed # If the LEFT key is pressed, move the player to the left if pressed[pygame.K_LEFT] and not pressed[pygame.K_RIGHT]: movement.x -= speed # If the RIGHT key is pressed, move the player to the right if pressed[pygame.K_RIGHT] and not pressed[pygame.K_LEFT]: movement.x += speed if movement.x != 0 or movement.y != 0: # Deflate. Where 3 pixels away from edge rect = screen.get_rect().inflate(-6, -6) moved = char.move(movement.x, movement.y) if moved.collidelist(fences) == -1 and rect.contains(moved): char = moved
99 percent of computer problems exists between chair and keyboard.