CompSci 94 - Classwork 14 - Oct 22, 2013
Today's classwork goes along with Chapter 7, Section 2 and Tips and
covers more "while" loops, with and without events, and "when" with event.
The following work needs to be checked off when you have completed it.
Make a copy of the ClickACow world you created last time and name it
Modify the game to use a "while" statement so that the game stops as soon as one of the following
things happens: The cow has been clicked on the targetted number of times,
or the timer has run down. The cow should say an appropriate message
as it did last class period.
- Create a new Alice world with snow or ice that has a penguin and a fish lying
on top of the snow or ice.
- Use the Event loop BDE (Begin During End) to have the
penguin move over to the fish, bend over and eat it whenever the fish is
(fish should disappear when he eats it).
Note: DO NOT use
the "walk" penguin method, there appears to be a bug in it. You can
just move the penguin forward 1 meter at a time.
- Add another event (when you press a key) to make the fish appear (no longer
invisible) in a random place on the ice.
Try pressing this key after the penguin has eaten the fish
so the fish reappears somewhere else and the BDE event kicks in again,so
penguin goes over to the fish
and eats it.
- Add a zamboni (vehicle folder) to the world. Add the "Let the arrow
move" event and use the arrow keys to control the zamboni.
- Add an event ("when something is true") so that when the penguin
is close to the zamboni, then he gets up in the drivers seat and "sticks"
to the seat (vehicle property). You should then control the zamboni with
arrow keys to
have it drive away with the penguin. You also do not want the
penguin to try to eat the fish if it becomes visible and the penguin
is on the zamboni.
NOTE: How do you find this event, it is
See the lecture notes.
NOTE2: The zamboni is one big object, no parts. You might want to glue an
object near the entrance to the driver's seat and compare if the penguin is close
to the invisible object.
NOTE3: You don't want your BDE to kick in while the penguin is on the
zamboni. How do you prevent this?
- Create an event for the penguin to dismount back to the ground (and
reset the vehicle property). If the fish is visible then that event should
kick in once the penguin is unglued.
- You should create Instructions (billboard or 3D text).
- Play your world, whenever the fish is visible and the penquin is on
snow or ice, it should go over and eat it. Whenever the zamboni is close
to the penguin, he should go sit in the driver's seat. Play it with these
things happening at least twice each.
If you finish early, feel free to embelish your animation.