The function turns the sprite by the specified amount of degrees counter-clockwise. This changes the direction the sprite is facing.
The example demonstrates using key sensing to control the sprite's movement in Python.
Code
sprite = Sprite('Beetle')
sprite.setdirection(90)
sprite.gotoxy(0, 0)
while True:
if sprite.iskeypressed('up arrow'):
sprite.move(3)
if sprite.iskeypressed('down arrow'):
sprite.move(-3)
if sprite.iskeypressed('left arrow'):
sprite.left(3)
if sprite.iskeypressed('right arrow'):
sprite.right(3)
Output
Read More