When you start KTurtle you will see something like this:
In this Getting Started guide we assume that the language of the TurtleScript commands is English. You can change this language with → . Be aware that the language you set here for KTurtle is the one you use to type the TurtleScript commands, not the language used by KDE on your computer and used to display the KTurtle interface and menus.
You must have noticed the turtle in the middle of the canvas: you are just about to learn how to control it using commands in the editor.
Let us start by getting the turtle moving. Our turtle can do 3 types of moves, (1) it can move forwards and backwards, (2) it can turn left and right and (3) it can go (jump) directly to a position on the screen. Try this for example:
forward 100 turnleft 90
Type or copy-paste the code to the editor and execute it (using → ) to see the result.
When you typed and executed the commands like above in the editor you might have noticed one or more of the following things:
That the color of the code changed while you where typing it: this feature is called intuitive highlighting — different types of commands are highlighted differently. This makes reading large blocks of code more easy.
That the turtle draws a thin black line.
Maybe you got an error message. This could simply mean two things: you could have made a mistake while copying the commands, or you should still set the correct language for the TurtleScript commands (you can do that by choosing → ).
The first example was very simple, so let us go on!
reset canvassize 200,200 canvascolor 0,0,0 pencolor 255,0,0 penwidth 5 go 20,20 direction 135 forward 200 turnleft 135 forward 100 turnleft 135 forward 141 turnleft 135 forward 100 turnleft 45 go 40,100
Again you can type or copy-paste the code to the editor or open the
arrow example in the menu and execute it (using → ) to see the result. In the next examples you are expected to know the drill.
You might have noticed that this second example uses a lot more code. You have also seen a couple of new commands. Here a short explanation of all the new commands:
reset command everything is like is was when you had just started KTurtle.
pencolor 255,0,0 sets the color of the pen to red.
255,0,0 is a RGB-combination where only the red value is set to
255 (fully on) while the others (green and blue) are set to
0 (fully off). This results in a bright shade of red.
go 20,20 commands the turtle to go to a certain place on the canvas. Counted from the upper left corner, this place is 20 pixels across from the left, and 20 pixels down from the top of the canvas. Note that using the
go command the turtle will not draw a line.
direction 135 set the turtle's direction. The
turnright commands change the turtle's angle starting from its current direction. The
direction command changes the turtle's angle from zero, and thus is not relative to the turtle previous direction.
direction command a lot of
turnleft commands follow. These command do the actual drawing.
At last another
go command is used to move the turtle aside.
Make sure you follow the links to the reference. The reference explains each command more thoroughly.