[Squeakland] Car race - dual tracks, timing,etc..
Ned Konz
ned at bike-nomad.com
Thu Nov 11 18:52:11 PST 2004
On Wednesday 10 November 2004 14:46, Herb Schilling wrote:
> Right now the way to tell the project which cars are in the race is a
> little awkward. You have to drag a car's tile to the setCarOne or
> setCarTwo scripts that are left open on the desktop. Then you have to
> click the "run this script once" button. I wish there were a way to
> drag and drop a car onto a button or morph and have that set the car
> assign to a race. I don't know how to do that.
Hi Herb,
There is a much easier way to do this.
The important idioms are "sendToAll:" to talk to a group of siblings, indirect
references to other objects, and detection of morph position to figure out if
cars are on top of each track.
See my version (many less scripts) at
http://bike-nomad.com/squeak/Two%20Track%20Herb.004.pr
It will also scale; merely making a sibling of a track will make a 3-way race.
--
Ned Konz
http://bike-nomad.com
More information about the Squeakland
mailing list