moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / doc / kturtle / getting-started.docbook
blob1059f5b6e92e6640f8eca83cb490628b902798b4
1 <!--Dear translator: please NEVER translate the id or anything inside the tags as they are needed in english by the application
2      Thanks a lot in advance.-->
3 <chapter id="getting-started">
4 <title>Getting Started</title>
5 <para>When you start &kturtle; you will see something like this:
6 <screenshot>
7   <screeninfo>Here is a screenshot of &kturtle; when you start it for the first time</screeninfo>
8   <mediaobject>
9     <imageobject>
10       <imagedata fileref="mainwindow.png" format="PNG"/>
11     </imageobject>
12     <textobject>
13       <phrase>&kturtle; Main window</phrase>
14     </textobject>
15   </mediaobject>
16 </screenshot>
17 In this Getting Started guide we assume that the language of the &logo; commands is English. You can change this language in <menuchoice><guimenu>Settings</guimenu><guimenuitem>Configure &kturtle;...</guimenuitem></menuchoice> in the <guilabel>Language</guilabel> section. Be aware that the language you set here for &kturtle; is the one you use to type the &logo; commands.</para>
19 <sect1 id="first-steps">
20 <title>First steps with &logo;: meet the Turtle!</title>
21 <para>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 code editor.</para>
23 <sect2 id="the-turtle-moves">
24 <title>The Turtle Moves</title>
25 <para>Let us start by getting the turtle moving. Our turtle can do 3 types of moves, (1) it can go forwards and backwards, (2) it can turn left and right and (3) it can go directly to a position on the screen. Try this for example:</para>
26 <para>
27 <screen>
28 forward 100
29 turnleft 90 
30 </screen>
31 Type or copy-paste the code to the code editor and execute it (using <link linkend="file-execute"><menuchoice><guimenu>File</guimenu><guimenuitem>Execute Commands</guimenuitem></menuchoice></link>) to see the result.</para>
33 <para>When you typed and executed the commands like above in the code editor you might have noticed one or more of the following things:</para>
34 <orderedlist>
35 <listitem><para>That &mdash; after executing the commands &mdash; the turtle moves up, draws a line, and then turns a quarter turn to the left. This because you have used the <link linkend="forward"><userinput>forward</userinput></link> and the <link linkend="turnleft"><userinput>turnleft</userinput></link> commands.</para>
36 </listitem>
37 <listitem>
38 <para>That the color of the code changed while you where typing it: this feature is called <emphasis>intuitive highlighting</emphasis> &mdash; different types of commands are highlighted differently. This makes reading large blocks of code more easy.</para>
39 </listitem>
40 <listitem>
41 <para>That the turtle draws a thin black line.</para>
42 </listitem>
43 <listitem>
44 <para>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 &logo; commands (you can do that by choosing <menuchoice><guimenu>Settings</guimenu><guimenuitem>Configure &kturtle;...</guimenuitem></menuchoice>, in the <guilabel>Language</guilabel> section).</para>
45 </listitem>
46 </orderedlist>
48 <para>You will likely understand that <userinput>forward 100</userinput> commanded the turtle to move forward leaving a line, and that <userinput>turnleft 90</userinput> commanded the turtle to turn 90 <glossterm linkend="degrees">degrees</glossterm> to the left.</para>
50 <para>Please see the following links to the reference manual for a complete explanation of the new commands: <userinput>forward</userinput>, <userinput>backward</userinput>, <userinput>turnleft</userinput>, and <userinput>turnright</userinput>.</para>
51 </sect2>
53 <sect2 id="more-examples">
54 <title>More examples</title>
55 <para>The first example was very simple, so let us go on!</para>
57 <para>
58 <!--translators: if it's not already there, you can copy/paste the translated code below and save it in arrow.logo in your examples folder: kde-i18n/language-code/data/kdeedu/kturtle/ -->
59 <screen>
60 canvassize 200,200
61 canvascolor 0,0,0
62 pencolor 255,0,0
63 penwidth 5
64 clear
66 go 20,20
67 direction 135
69 forward 200
70 turnleft 135
71 forward 100
72 turnleft 135
73 forward 141
74 turnleft 135
75 forward 100
76 turnleft 45
78 go 40, 100
79 </screen>
80 Again you can type or copy-paste the code to the code editor or open the <filename>arrow.logo</filename> file in the <guimenu>Open examples</guimenu> folder and execute it (using <link linkend="file-execute"><menuchoice><guimenu>File</guimenu><guimenuitem>Execute Commands</guimenuitem></menuchoice></link>) to see the result. In the next examples you are expected to know the drill.</para>
82 <para>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:</para>
84 <para><userinput>canvassize 200,200</userinput> sets the canvas width and height to 200 <glossterm linkend="pixels">pixels</glossterm>. The width and the height are equal, so the canvas will be a square.</para>
86 <para><userinput>canvascolor 0,0,0</userinput> makes the canvas black. <userinput>0,0,0</userinput> is a <glossterm linkend="rgb">RGB-combination</glossterm> where all values are set to <userinput>0</userinput>, which results in black.</para>
88 <para><userinput>pencolor 255,0,0</userinput> sets the color of the pen to red. <userinput>255,0,0</userinput> is a <glossterm linkend="rgb">RGB-combination</glossterm> where only the red value is set to <userinput>255</userinput> (fully on) while the others (green and blue) are set to <userinput>0</userinput> (fully off). This results in a bright shade of red.</para>
90 <para>If you do not understand the color values, be sure to read the glossary on <glossterm linkend="rgb">RGB-combination</glossterm>s</para>
92 <para><userinput>penwidth 5</userinput> sets the width (the size) of the pen to <userinput>5</userinput> <glossterm linkend="pixels">pixels</glossterm>. From now on every line the turtle draw will have a thickness of <userinput>5</userinput>, until we change the <userinput>penwidth</userinput> to something else.</para>
94 <para><userinput>clear</userinput> clear the canvas, that is all it does.</para>
96 <para><userinput>go 20,20</userinput> commands the turtle to go to a certain place on the canvas. Counted from the upper left corner, this place is 20 <glossterm linkend="pixels">pixels</glossterm> across from the left, and 20 <glossterm linkend="pixels">pixels</glossterm> down from the top of the canvas. Note that using the <userinput>go</userinput> command the turtle will not draw a line.</para>
98 <para><userinput>direction 135</userinput> set the turtle's direction. The <userinput>turnleft</userinput> and <userinput>turnright</userinput> commands change the turtle's angle starting from its current direction. The <userinput>direction</userinput> command changes the turtle's angle from zero, and thus is not relative to the turtle previous direction.</para>
100 <para>After the <userinput>direction</userinput> command a lot of <userinput>forward</userinput> and <userinput>turnleft</userinput> commands follow. These command do the actual drawing.</para>
102 <para>At last another <userinput>go</userinput> command is used to move the turtle aside.</para>
104 <para>Make sure you follow the links to the reference. The reference explains each command more thoroughly.</para>
107 </sect2>
108 </sect1>
112 <!--        EXTRA SECTIONS CAN BE ADDED TO THE "GETTING STARTED"
114 <sect1 id="calculations">
115 <title>Simple Calculations</title>
116 <para>
117 Not yet written
118 </para>
119 </sect1>
120 <sect1 id="using_variables">
121 <title>Using Variables: creating 'number containers'</title>
122 <para>
123 Not yet written
124 </para>
125 </sect1>
126 <sect1 id="using_strings">
127 <title>Using strings: creating 'text containers'</title>
128 <para>
129 Not yet written
130 </para>
131 </sect1>
132 <sect1 id="logic">
133 <title>Logic: asking the computer simple questions</title>
134 <para>
135 Not yet written
136 </para>
137 </sect1>
138 <sect1 id="recursion">
139 <title>Recursion: the Turtle is using itself</title>
140 <para>
141 Draw a maze for example
142 </para>
143 </sect1>
147 </chapter>