This article introduces Turtle in Microsoft Small Basic programming language.
In this article:
Turtle comes from Logo programming language. It's called Turtle Graphics. Basically to turn and to move the turtle causes graphic shapes. Details about Turtle history is written in a TechNet Wiki article.
Turtle
.
Show
(
)
This one-line code above shows the turtle like following picture.
The Turtle object provides functionality do draw shapes like Logo programming language.
There are following four properties in Turtle object.
There are following nine operations in Turtle object. These operations don't return any values.
There was a know issue that the turtle can't be shown if once hided. This means that also the turtle graphics (trails) could be cleared only one time with GraphicsWindow.Clear(). But still remains an issue that there is no standard way to remove turtle trials only. To remove turtle trails, there is a workaround which detail is written in a blog article.
' Turtle Object Code Sample
' Turtle.Show() operation
' Turtle.PenUp() and Turtle.MoveTo() operations
PenUp
x
=
320
y
400
MoveTo
,
' Turtle.Angle property
Angle
45
' show properties
GraphicsWindow
BrushColor
"Gray"
DrawText
10
"Turtle.X="
+
X
30
"Turtle.Y="
Y
50
"Turtle.Angle="
70
"Turtle.Speed="
Speed
Program
Delay
3000
' Turtle.PenDown() operation
PenDown
PenColor
"Red"
' Turtle.Move() operation
distance
130
Move
' Turtle.Turn() and Turtle.Move operations
angle
-
90
Turn
' Turtle.TurnRight() and Turtle.Move operations
TurnRight
' Turtle.TurnLeft() and Turtle.Move operations
TurnLeft
' Turtle.Hide() operation
Hide