[squeakland] Collision detection, only one object detects the collision

Carl Cravens raven at phoenyx.net
Mon Nov 30 17:42:58 EST 2009


Thanks for all the responses on this.

Bert Freudenberg wrote:

> What if the bullet does a "I'm not over the background" test?
> 
> But yes, in general Etoys is set up not to make things pretty but to
> allow the principles to be applied directly.

My nine-year-old likes "pretty".  He wants to write Flash games, but getting the tools set up on Linux to achieve "hello world" seems to be a monumental task. :)

The bullet needs to detect collisions with four different kinds of things (invader, base shield, bonus saucer, and invader bomb).  In three cases, they're more or less the same thing... some other object with its own collision scripts.  In the case of the shield, that's just a stamp on the background, and I'm using "over color" there.

I could use "not over background color" but I still have to get the right object to respond to the collision, which means signaling *everything* to check if it's been hit, and not just one "class" of object.  For now, seeing as I've uncovered a bug, I've switched to "over color" detection and that's working fine.  But "foo overlaps with any bar" seems to be the ideal tool for what I'm doing.  (Though I'm getting a hint here that it may not be as efficient as detecting simple color overlaps.)

This is turning into a much more complicated project than I expected.  That's good... I've learned a lot about Etoys in a short time.  It's been a fun challenge, and I feel pretty prepared for my son's questions.

Thanks!
 
-- 
Carl D Cravens (raven at phoenyx.net)
"I'm wearing Boots of Escaping, I'm wearing Boots of Escaping..."


More information about the squeakland mailing list