so I have a lever image with 3 different directions my problem is when I use the if [pygame.K_p] mutliple times I want to switch between the defferent images but heres my problem VIDEO when I click p it display right and the middle one but not the left one and I have to hold the p for some reason to switch it I want it so when I click p 1 time it switches direction of my lever.
In My Main Loop here what I have done for the first one I said if we click p then move1 should be True then if my move1 is true then it should switch my direction of my lever image to right one then my next one of my image is on the right and we click p again it should switch my image back to 1 the middle one and like repeat I am not sure if I am doing correctly but yeah
switch1 is the *left switch2 is the middle switch3 right one
if keys[pygame.K_p]:
move1 = True
move2 = False
if keys[pygame.K_p]:
if switch1.direction == "switch3":
move1 = False
move2 = True
if switch1.direction == "switch3" or switch1.direction == "switch1":
if keys[pygame.K_p]:
switch1.direction = "switch2"
if switch1.direction == "switch2":
move1 = False
move2 = False
if move1:
move2 = False
switch1.direction = "switch3"
if rop1.y <= 200:
rop1.y += 2
else:
rop1.direction = "nomove"
if move2:
move1 = False
switch1.direction = "switch1"
if rop1.y <= 200:
rop1.y -= 2
else:
rop1.direction = "nomove"
I am looking for a way to switch my levers with 1 keybind "p" left right or middle repeat Thank You!



