On Tue, 29 Jan 2002 18:34:20 +0100 Karl Ramberg karl.ramberg@chello.se wrote:
Bob Arning wrote:
Rik,
The *feature* probably overlooked is that this only works for SketchMorphs and I'm gessing (Star) is a StarMorph. What it will do is something like
paint a blue star freehand name it "bluestar" some script can change its object's appearance by saying "foo look like bluestar" some other script can say "bar's touchesA bluestar" and you should get a true if foo overlaps bar.
Maybe the test should work on all morphs( e.g. the rendered form of each morph = to avoid this confusion and have it work as a general collition detection for the etoy scripting ?
All those kids making all those games need it :-)
Well, probably, but one of my main goals here was to make something reasonably fast for uses like the epidemic etoy. The existing colorSees was just too slow to be useful in this case and that's because it *does* render each morph to see if it contains a particular color in a particular place. Possibly more useful in the general case would be a "touches" variant that queried some attribute/property of each morph.
Cheers, Bob
I too wondered about "touchesA", and I couldn't even get it to work consistently with SketchMorphs, Bob Arning's post of 1/29/02 to the contrary.
I did manage to track down something however. This is what I did:
I created a SketchMorph and called it "Blob". I then created another SketchMorph and called it "StarSketch".
I created a script for Blob consisting of a Test: the Test was whether the Blob touchesA StarSketch. If Yes, then Blob should make the "croak" sound.
I then dragged the Blob on top of the StarSketch and fired the script. It did not work!
After a number of unsuccessful and therefore inconsequential variations, I happened to create a duplicate of the StarSketch (using the green "duplicate" handle on its halo). I added another Test to my script: the Test was the (built-in) test for whether the StarSketch touchesA StarSketch. If Yes, then StarSketch should make the "clink" sound.
I then dragged StarSketch over its duplicate, StarSketch1, and fired the script. Clink!
Dragged the Blob over StarSketch1, fired the script. Croak!
But Blob over original StarSketch ... nothing.
This can't be the intended behavior of touchesA, can it? Is there something obvious (or nonobvious) that I'm missing, or is this a bug?
- Jerry
P.S. For the record, here is the textual code for the script: script1 (self touchesA: StarSketch) ~~ false ifTrue: [self beep: 'croak']. (StarSketch touchesA: StarSketch) ~~ false ifTrue: [StarSketch beep: 'clink']
P.P.S. Version 3.2gamma-4743 trashes a scriptor if you try to toggle back and forth between tiles and textual code views of a script. (I am using a Mac, System 9.1)
squeak-dev@lists.squeakfoundation.org