Table of Contents

Sprite Direction – Python

Example Description
The example demonstrates the sprite direction in Python.

Code

sprite = Sprite('Arrow1')

sprite.gotoxy(0, 0)
sprite.setsize(300)

while True:
  if sprite.iskeypressed("left arrow"):
    sprite.left(3)
  if sprite.iskeypressed("right arrow"):
    sprite.right(3)
  sprite.say("Direction is " + str(sprite.direction()))

Output