You want heading()
, not tiltangle()
. The heading()
method gives you the direction that the turtle is currently facing, which you can change with left()
, right()
, or setheading()
.
The tiltangle()
method is for changing the visual appearance of the cursor, not its actual heading on the screen. For example, in a Space Invaders style game, I've used the turtle-shaped cursor with a heading of 0 (zero) degrees so I can use forward()
and backward()
to move it on the screen. But I want the turtle image itself to point upward towards the invaders. So, I set it's tiltangle()
to 90 so it's facing upward but moving left and right.
def collide(self):
initial_angle = self.heading()
self.right(initial_angle + 90)
is the same as:
def collide(self):
self.right(90)
As noted in the documentation, tiltangle()
is "the angle between the orientation of the turtleshape and the heading of the turtle (its direction of movement)"