Jan-18-2018, 08:24 PM
Heya, i'm using the turtle module in pycharm community edition 2017.2.3
I am trying to get a simple movement system with a keyboard, using this code:
worth mentioning I also have a loop in the end of the code:
I am trying to get a simple movement system with a keyboard, using this code:
def right(): player.goto(player.xcor() + 10, player.ycor()) print("ay") def left(): player.goto(player.xcor() + 10, player.ycor()) print("hi") turtle.onkeypress(right(), "Right") turtle.onkeypress(left(), "Left") turtle.listen()for some reason, nothing happens when I press either of the keys.
worth mentioning I also have a loop in the end of the code:
while True: cur = player.pos() if cur in walls: player.forward(x) x = x + 0.05Hopefully it's a simple fix - thanks in advance!