if keyboard.h and start == False:
start = True
print("hello?")
dotty_move()
if keyboard.h and start == True:
start = False
print("bye")
dot1.pos = x, y
dot2.pos = xi, yi
def dotty_move():
global speed, speedi, start
if start == True:
animate(dot1, duration = speedi, pos = (xi, 0), on_finished = dot_move())
animate(dot2, duration = speed, pos = (x, 0), on_finished = dot_move())
def dot_move():
global speed, speedi, start, x, y, xi, yi, dot1
if start == True:
animate(dot1, pos=(0, 425), on_finished = dotty_move())
print("test")
animate(dot2, duration = speed, pos = (x, 425), on_finished = dotty_move())
dot_move()
Hello! Everything before the dotty_move()
subroutine (I have really bad names for my subroutines haha) is in the update()
subroutine.
I am trying to have the input of the key "h" only happen once, but it seems to input 3 times if I press it for a split second. I think this is because it's in the update class, but I couldn't find another way to check for the key press.
This code is meant to make two dots in pre-set x coordinates move up and down over and over with a defined speed whenever you press "h". If you press "h" again it is supposed to stop this. The reason I think this isn't working at the moment is because of the issue I stated earlier: it's turning on and off so it never does anything.
But I don't know. If anyone can help it, would be really appreciated. Thanks :)