Warning, /education/kturtle/doc/getting-started.docbook is written in an unsupported language. File is not indexed.

0001 <chapter id="getting-started">
0002 <title>Getting Started</title>
0003 <para>When you start &kturtle; you will see something like this:</para>
0004 <screenshot>
0005   <screeninfo>Here is a screenshot of &kturtle; when you start it for the first time</screeninfo>
0006   <mediaobject>
0007     <imageobject>
0008       <imagedata fileref="mainwindow.png" format="PNG"/>
0009     </imageobject>
0010     <textobject>
0011       <phrase>&kturtle; on a fresh start</phrase>
0012     </textobject>
0013   </mediaobject>
0014 </screenshot>
0015 <para>In this Getting Started guide we assume that the language of the &turtlescript; commands is English. You can change this language with the <menuchoice><guimenu>Settings</guimenu><guisubmenu>Script Language</guisubmenu></menuchoice> submenu. 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.</para>
0016 
0017 <sect1 id="first-steps">
0018 <title>First steps with &turtlescript;: meet the Turtle!</title>
0019 <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 editor.</para>
0020 
0021 <sect2 id="the-turtle-moves">
0022 <title>The Turtle Moves</title>
0023 <para>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:</para>
0024 <para>
0025 <screen>
0026 forward 100
0027 turnleft 90 
0028 </screen>
0029 Type or copy-paste the code to the editor and execute it (using <link linkend="run-execute"><menuchoice><guimenu>Run</guimenu><guimenuitem>Run</guimenuitem></menuchoice></link>) to see the result.</para>
0030 
0031 <para>When you typed and executed the commands like above in the editor you might have noticed one or more of the following things:</para>
0032 <orderedlist>
0033 <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>
0034 </listitem>
0035 <listitem>
0036 <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>
0037 </listitem>
0038 <listitem>
0039 <para>That the turtle draws a thin black line.</para>
0040 </listitem>
0041 <listitem>
0042 <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 &turtlescript; commands (you can do that by choosing the <menuchoice><guimenu>Settings</guimenu><guisubmenu>Script Language</guisubmenu></menuchoice> submenu).</para>
0043 </listitem>
0044 </orderedlist>
0045 
0046 <para>You will likely understand that <userinput>forward 100</userinput> instructed the turtle to move forward leaving a line, and that <userinput>turnleft 90</userinput> instructed the turtle to turn 90 <glossterm linkend="degrees">degrees</glossterm> to the left.</para>
0047 
0048 <para>Please see the following links to the reference manual for a complete explanation of the new commands: <link linkend="forward"><userinput>forward</userinput></link>, <link linkend="backward"><userinput>backward</userinput></link>, <link linkend="turnleft"><userinput>turnleft</userinput></link>, and <link linkend="turnright"><userinput>turnright</userinput></link>.</para>
0049 </sect2>
0050 
0051 <sect2 id="more-examples">
0052 <title>More examples</title>
0053 <para>The first example was very simple, so let us go on!</para>
0054 
0055 <para>
0056 
0057 <screen>
0058 reset
0059 
0060 canvassize 200,200
0061 canvascolor 0,0,0
0062 pencolor 255,0,0
0063 penwidth 5
0064 
0065 go 20,20
0066 direction 135
0067 
0068 forward 200
0069 turnleft 135
0070 forward 100
0071 turnleft 135
0072 forward 141
0073 turnleft 135
0074 forward 100
0075 turnleft 45
0076 
0077 go 40,100
0078 </screen>
0079 Again you can type or copy-paste the code to the editor or open the <filename>arrow</filename> example in the <guimenu>Examples</guimenu> submenu and execute it (using <link linkend="run-execute"><menuchoice><guimenu>Run</guimenu><guimenuitem>Run</guimenuitem></menuchoice></link>) to see the result. In the next examples you are expected to know the drill.</para>
0080 
0081 <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>
0082 
0083 <para>After a <userinput>reset</userinput> command everything is like is was when you had just started &kturtle;.</para>
0084 
0085 <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>
0086 
0087 <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>
0088 
0089 <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>
0090 
0091 <para>If you do not understand the color values, be sure to read the glossary on <glossterm linkend="rgb">RGB-combination</glossterm>.</para>
0092 
0093 <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>
0094 
0095 <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>
0096 
0097 <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>
0098 
0099 <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>
0100 
0101 <para>At last another <userinput>go</userinput> command is used to move the turtle aside.</para>
0102 
0103 <para>Make sure you follow the links to the reference. The reference explains each command more thoroughly.</para>
0104 
0105 
0106 </sect2>
0107 </sect1>
0108 
0109 
0110 
0111 <!--        EXTRA SECTIONS CAN BE ADDED TO THE "GETTING STARTED"
0112 
0113 <sect1 id="calculations">
0114 <title>Simple Calculations</title>
0115 <para>
0116 Not yet written
0117 </para>
0118 </sect1>
0119 <sect1 id="using_variables">
0120 <title>Using Variables: creating 'number containers'</title>
0121 <para>
0122 Not yet written
0123 </para>
0124 </sect1>
0125 <sect1 id="using_strings">
0126 <title>Using strings: creating 'text containers'</title>
0127 <para>
0128 Not yet written
0129 </para>
0130 </sect1>
0131 <sect1 id="logic">
0132 <title>Logic: asking the computer simple questions</title>
0133 <para>
0134 Not yet written
0135 </para>
0136 </sect1>
0137 <sect1 id="recursion">
0138 <title>Recursion: the Turtle is using itself</title>
0139 <para>
0140 Draw a maze for example
0141 </para>
0142 </sect1>
0143 -->
0144 
0145 
0146 </chapter>