MicroWorlds EX™ Lessons
Lesson Three: Graphics -
Colors, Brushes and Backgrounds
setc # - (any number from 1 to 139) will set the color of the turtle, and therefore the color it will use for drawing lines as it moves on the screen
setbg # - (any number from 1 to 139) will set the color of the screen background, underneath any lines that are drawn and behind any graphics painted with the brush
| A full list of the colors from 1 to 139 is available
once you click on the "painting/clip
art/shapes" icon on the top toolbar. (yellow diamond with a paintbrush coming down through it) This will display a tall window on the right side of the screen that will list all the colors, a variety of paint brushes and even some wallpaper-like patterns on the bottom of the window. (Colors are in the middle of the graphics section. the slider just below the colors will help you to adjust how transparent the color will appear once it is on the screen..) |
![]() |
The brush options are shown above the colors section on the graphics tab. Double-clicking on these will allow you to change the settings for the brush function. These are helpful in quickly painting a design on top of the screen background. If you cover a screen with these graphics, you will no longer be able to see the screen’s background, so changing the background color won’t matter until you hit cg and clear the graphics.
fill allows you to fill in a section of the screen with
your current drawing color. The new color will be poured into as much of the
screen as it can reach until it hits a line or the edge of the screen.
(NOTE: When you want to fill an area, your turtle must arrive at that
spot with its pen up. Otherwise, when you tell it to fill, the dot under your
turtle's pen has already been filled with that color, so the turtle will think
it is already finished filling in that color.)
One easy way to split your screen is with a “horizon line”. Just
type pu home to get your turtle in the home
position without drawing a line, then pd rt 90 setc 9 fd 800
to put the pen back down, turn the turtle right, set the pencolor back to black,
and draw a line that goes all the way around the screen.
Then, you can fill in the areas above and below the line with appropriate colors
for land and sea, or earth and sky…. Just type pu lt 90 fd 20
setc # (your choice) pd fill for the top half of the
screen, followed by pu bk 40 setc # (your choice) pd
fill for the bottom half.
Graphics & Shapes
To change shapes, use the setshape command. Just type setsh # (Select the number you want by pausing the mouse’s pointer on the shape you like to find the number just after the name of the shape.)
The standard size for all shapes is 40. To make a shape bigger
or smaller than the default version, use the setsize command.
Setsize 30 will make the shape smaller and setsize
50 will make it larger.
(This may be useful to make things appear to be closer to the viewer or further
away in relation to other objects.)
The stamp command will stamp a single copy of the current size and appearance of the shape on the screen and that image will remain there until you use the cg command.
| To see the great variety of different shapes that come with MicroWorlds EX, just click the images at the top of the Painting/ ClipArt window. | ![]() |
(For more on Animation of Shapes, see Lesson Four)
Exact Positions on the Screen
It might be helpful to place a turtle in an exact position on the screen.
To do that, you need to learn the setposition command. In
order to use that, you need to understand the idea of the Cartesian Plane,
or coordinate
plane, from the world of Mathematics. (This is the plane described by a horizontal
x-axis and a vertical y-axis with
all points on it having co-ordinates compared to the Origin (0,0).)
The center of the screen is said to have position [0 0]. All other positions
are relative to that point. The MicroWorlds Pro project screen is 744 pixels
wide, so you can go all the way from the far left with setpos [-371
0] to the far right with setpos [371 0]. The
screen is 426 pixels high so you can go from the middle of the top of the
screen
at
setpos [0 212] to the middle of the bottom of the screen
with
setpos [0 –212] (Positive numbers for the first number
(x) make the turtle move right of center and negative
numbers move it to the left of center. Positive numbers for the second number
(y) will keep the turtle above the center of the
screen, and negative numbers will place it on the bottom half of the screen. NOTE:
if you go off the edge of the screen with a larger number, it will come back
around the opposite edge!)
You can watch the turtle make the tour of the edges of the screen by copying and pasting the following group of commands into your procedures area.
to screenlimit
setpos [371 0] wait 1
setpos [371 -212] wait 1
setpos [0 -212] wait 1
setpos [-371 -212] wait 1
setpos [-371 0] wait 1
setpos [-371 212] wait 1
setpos [0 212] wait 1
setpos [371 212] wait 1
end
Wait 1 is the command to tell the turtle to wait for 1/10 of a second. This is just long enough for you to see him before he zips off to the next spot.
Putting It All Together - Size & Position
By repeating the same shape in a different size, you can create the illusion of depth in your drawings. If you have studied perspective in art class, you learned that there is a convergence point that will appear to be at the furthest distance in your drawings. If you recreate similar shapes in larger sizes as you move further away from that convergence point, you will create the illusion of depth. Copy and paste the series of commands below to see one example of this in a procedure. The convergence point for this example is located at [-60 140].
to perspective
setsize 5 setpos [-60 140] pd stamp pu setpos [-60 140] pd stamp pu
setsize 10 setpos [-20 115] pd stamp pu setsize 10 setpos [-80 115] pd stamp
pu
setsize 15 setpos [20 90] pd stamp pu setsize 15 setpos [-100 90] pd stamp pu
setsize 20 setpos [60 65] pd stamp pu setpos [-120 65] pd stamp pu
setsize 25 setpos [100 40] pd stamp pu setpos [-140 40] pd stamp pu
setsize 30 setpos [140 15] pd stamp pu setpos [-160 15] pd stamp pu
setsize 35 setpos [180 -10] pd stamp pu setpos [-180 -10] pd stamp pu
setsize 40 setpos [220 -35] pd stamp pu setpos [-200 -35] pd stamp pu
end
| Here's what it should look like: | ![]() |
Aiming Turtles with Turns and Setheading command
The setheading command is useful for guaranteeing that any given turtle is aimed in the proper direction you want. (This is especially important because only the turtle remains pointed in the direction he is currently heading. All other shapes LOOK LIKE they are always oriented in the straight up position no matter which way there are truly aimed.) Setheading 270 will aim a shape straight to the left. Setheading 180 will aim a shape straight downward. To see a demonstration of the turtle aiming in 36 different directions, you need to create a SLIDER called “AimingAt” with a minimum of 0 and a maximum of 360, and a TEXTBOX that is wide enough to show the message below and tall enough to show two lines at a time. (PS “Wait 20” tells the turtle to wait 2 seconds between steps)
| to TeachHeading ct setheading aimingat pr [This is heading ]pr aimingat wait 20 setaimingat aimingat + 10 teachheading end |
![]() |
"Turtle Total Trip Theorem" - Doing a 360!
When steering the turtle, it is often useful to steer the turtle around the screen AND HAVE THE TURTLE GET BACK HOME (or where he started!). To get him to the home position at ( 0 , 0 ) in the center of the screen quickly, you can always just type home . However, it is better to have the turtle return to the same position SMOOTHLY as part of a procedure. To do this, you can easily make Regular Polygons (those with all sides the same AND all angles the same) by using the repeat commands below:
to triangle
repeat 3 [ fd 77 rt 120 ]
end
to square
repeat 4 [ fd 77 rt 90 ]
end
to pentagon
repeat 5 [ fd 77 rt 72 ]
end
to hexagon
repeat 6 [ fd 77 rt 60 ]
end
to decagon
repeat 10 [ fd 77 rt 36 ]
end
to 36gon
repeat 36 [ fd 77 rt 10 ]
end
Notice that in all these cases, the PRODUCT of the number of turns or angles times the number of degrees in each turn or angle must always equal 360. Try it out yourself with other shapes, turns and lengths of sides, then make a pattern using a variable to make a regular polygon with any number of sides!
Lesson Four: Animation in MicroWorlds EX
| HTS Home | | | Calendar | | | Classes | | | Departments | | | Resources | | | What's New? | Newsletter |