Skip to content

AvoidTurtleInHandler

Nonki Takahashi edited this page Apr 24, 2017 · 2 revisions

AvoidTurtleInHandler

Use

Turtle.Show()
GraphicsWindow.KeyDown = OnKeyDown
While "True"
  If keyDown Then
    If key = "R" Then
      Turtle.TurnRight()
    EndIf
    keyDown = "False"
  Else
    Program.Delay(200)  ' for reducing server load
  EndIf
EndWhile
Sub OnKeyDown
  key = GraphicsWindow.LastKey
  keyDown = "True"
EndSub

instead of

Turtle.Show()
GraphicsWindow.KeyDown = OnKeyDown
Sub OnKeyDown
  If GraphicsWindow.LastKey = "R" Then
    Turtle.TurnRight()
  EndIf
EndSub

Other Resources


Clone this wiki locally