Using the Turtle to Draw Simple Pictures
Basic
Commands
| Buttons
| Save
the Project
| Conclusion
| Assignments
| Download the Project
Task
- To create simple pictures using turtle geometry
You need to understand
- basic commands of turtle geometry forward,
left, right, back, repeat, clean
You will learn
- how to paste buttons on a page and how to use them with the
commands
| The
same turtle commands in SuperLogo work also in the Imagine Logo
environment.
Try
typing several commands in the command line e.g. draw a simple
letter T
?
fd 100 rt 90 FD 50 bk 100
|
 |
Command clean
The effect of this command is different to SuperLogo - the screen
will be cleaned, but the turtle stays in the same place (it does
not go to its home position and will not turn to its initial heading).
To return the turtle to its home position and initial heading use
the command clean.
Try
? clean
; the turtle stays in the position where it has
finished the letter T
? clearscreen
; the turtle returned into the home position (0,0)
and initial heading to the North
Pen colour, width and pattern
Use the command setPenColour
or setPC
to draw with a coloured pen. To find the right
colour press <Enter> and the Colours
chooser will open. You can select or mix the colours.
Several colours are named e.g. "white,
"blue, "red, etc.
Similarly, you can use the command
setPenWidth
or setPW
to set the turtle's pen width.
Type in these commands to draw a blue flag - the pole and the flag
have a length of 100 and pen width of 5
?
clear
? setPC "blue
? setPW 5
? FD 100
? repeat 4 [FD 100 rt 90]
Pasting a button, and defining an event
To save time you can put turtle commands on buttons. In Superlogo
you have the Button window, in Imagine Logo you can use the buttons
directly on the page, you can move them, resize them, put images
on them... The icon for inserting a new button is situated in the
Main Bar - select it and put the button on the page. Click with
the right mouse button on the selected button and in its context
menu select Change
b1. Change the button's Caption
and event
onPush
to the command clearscreen.
Click on OK.
Changing a button's size and position
You can see
the new button, but the word 'clearscreen' is not wholly visible
- you need to resize it: in the lower right-hand corner of the
button press the <Ctrl> key and the right mouse button simultaneously
- the cursor will change into a and you
can resize the button by dragging it to the right.
If you want to move any button, select Move
b1 from its context menu
and drag the button into a new position.
You can now make buttons for moving
forward 50, turning right 90, turning left 90, etc. in exactly
the same way.
|
 |
Select Save Project As... from the File menu and
give it a name in the Save project dialogue box.
You have created a simple project that allows you to draw pictures
by controlling the turtle using buttons. You do not have to write
all the commands, you can just press the buttons.
|
1. Draw the following simple pictures using
your buttons: a flag, a pair of glasses, and a windmill.
2. Add more buttons to control the turtle's
pen colour.
3. Make up other commands, create
a button on the page, and then draw your own picture.
|
 |
You can download an example of the finished project by clicking
here.
|