This is my code to make a rocket move around in a turtle screen:
import turtle
s = turtle.Screen()
image = "rocket.gif"
s.addshape(image)
turtle.shape(image)
s.bgcolor("black")
def fd():
turtle.fd(5)
def bk():
turtle.bk(10)
def lt():
turtle.lt(5)
def rt():
turtle.rt(5)
turtle.penup()
turtle.speed(0)
turtle.home()
s.listen()
s.onkeypress(fd, "Up")
s.onkeypress(bk, "Down")
s.onkeypress(lt, "Left")
s.onkeypress(rt, "Right")
When I press the up button the rocket moves forward, and when I press the right button, the rocket image does not turn, but when it moves forward again the direction of the movement does change.
I read this at the help() section at Python3 IDLE:
Image shapes do not rotate when turning the turtle, so they do not display the heading of the turtle!
But, I do not understand is this for turtle.rt() or turtle.setheading()? Even if it is for both, how do I rotate the image?
Note: Surprisingly it works with trinket.io