Table of Contents
Example Description
The example demonstrates how to control the motion of the robot using keyboard keys in the Python Coding Environment.

Code

sprite = Sprite('Tobi')
quarky = Quarky()

while True:
  
  if sprite.iskeypressed("up arrow"):
    quarky.runrobot("FORWARD", 50)
  elif sprite.iskeypressed("down arrow"):
    quarky.runrobot("BACKWARD", 50)
  elif sprite.iskeypressed("left arrow"):
    quarky.runrobot("LEFT", 50)
  elif sprite.iskeypressed("right arrow"):
    quarky.runrobot("RIGHT", 50)
  else:
    quarky.stoprobot()

Output