|
|
Volume 7 Number 2 - Spring 1999
|
Computer Games for Kids, by Kids
...continued
This second starter is the same as the first with the addition
of a maze and a setup procedure.
Click here
to play with the starter right now.
The color red is programmed to turn the turtle right 180
when it bumps into a wall. This is the setup procedure:
to setup setpos [-150 -130] seth 0 end
Setup places the turtle at an appropriate starting
position and heading for the game to begin. The way to determine the
proper position is to use the mouse to put the turtle where you want it
to start and then type show pos in the command center. The pair
of numbers reported can then be copied onto the procedures page and
placed in brackets as the input to setup. The heading can be
determined by typing show heading, but this is often
unnecessary because the students generally use headings of 0, 90, 180,
or 270 degrees, which they recognize by inspection.
The third starter adds a moving obstacle: a turtle in the
shape of a spider. This spider turtle is also programmed to go forward
1 and its heading is set to 90. This is done by typing the command seth
90 in the command center. Once it is moving the spider turtle will
switch headings between 90 and 270 each time it bumps into the red
walls because red is programmed to cause all turtles to turn right
180.
Click here
to play with the starter right now.
Adding the spider also requires changes to the go procedure.
to go talkto [t1 t2] clickon forever [direct readchar] when [touching? "t1 "t2] [setup] end
Another difference between Macitnosh and PC
The instruction
talkto [t1 t2] clickon
works for the Macintosh version of MicroWorlds, but not
for the Windows version. Instead, use
ask [t1 t2] [clickon]
This second form works for both versions.
|
Both turtles must now be told to clickon and the collision
detection is established with the when command. Setup is also changed
so that it only talks to the original turtle and not the spider as
well.:
to setup t1, setpos [-140 -130] seth 0 end
Without this change both turtles would be sent to the starting
gate when there was a collision.
Most students did not use moving turtles in their mazes, but
collision detection was used in other kinds of games. Pong, Air Hockey,
and War Zone on the VideoGameWorks website are examples.
You can visit now by clicking here.
That website will open in a new window. Close or minimize that window
when you want to return to this article. Don't use your browser's back
button.
|
|