Basic Collision Detection

Phil Firsenbaum tacmanphil at
Mon Feb 10 18:08:29 PST 2003

I too am trying to learn my way around Squeak, especially the etoy 
environment. I found a terrific section in Mark Guzdial's Squeak book 
about creating an ellipse that simulates gravity as it falls. I added a 
variation by having my ellipse bounce off of an object when it lands on 
it. My ellipse is yellow and the object that it strikes is light blue. 
What you see below is the script that checks to see when the 2 colors 
meet. When that happens (and only then) is another script (kick) 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CompoundTile.gif
Type: image/gif
Size: 1998 bytes
Desc: not available
Url :
-------------- next part --------------

I hope this makes some sense to you and is helpful.

On Tuesday, January 28, 2003, at 07:10 AM, DeBusk, Jonathan Thomas 

> I've been working for the past few weeks on a very basic billiards game
> that requires collision detection. While I can "bounce" off the sides 
> of
> the table just fine, I'm having real trouble getting two balls to "see"
> one another and collide. I can't quite grasp how it should be done w/o
> some sort of brute force method where each ball checks to see if it
> currently colliding with every other ball.
> This way seems inefficient and requires a lot of work... plus I can
> never seem to figure out WHERE I should actually be detecting the
> collision (should the game sort of work this out, or should balls be
> responsible for their own collision detection?).
> At this stage, I don't need it to be very realistic, I just want it to
> work. Has anyone worked out a similar problem before (or seen code that
> does something similar in Smalltalk/Squeak)? Is there any advice anyone
> can give me?
> Thanks.

More information about the Squeakland mailing list