Helping my nephew with collision detection

Christopher Sawtell csawtell
Fri Apr 18 14:54:25 PDT 2003


randysiler at mac.com wrote:
> Hi All,
>     I'm helping my nephew (13) get started writing a game in Squeak 
> (trying to move him more into the joy of writing games rather than 
> playing games) and he has made some great strides but has a problem he 
> can't get through. I'd like to help him but at this point the extent of 
> my wisdom is pointing him at Squeak. If any of you could give us a hint 
> about how to proceed we'd both greatly appreciate it.
> 
>     Starting from the "make a car" tutorial Byron has now made a tank 
> and a steering wheel  and some balls that he wants to bounce back and 
> forth between two walls. He's quite exceited about the cool games he 
> could create trying to drive the tank through a field where these 
> bullets are bouncing back and forth and he has discovered that he needs 
> collision detection But we haven't been able to implement it yet. 
> Currently he has his balls (bullets) bouncing backand forth from the top 
> and bottom of the Squeak world but we can't get them to bounce off the 
> walls he has made.
> 
>     I've told him that I think Squeak has collision detection but it is 
> a little beyond me to actually show him how. It seems like we want to 
> write a test where the ball decides if it is touching a wall. We see 
> "touches" but we can't get it to allow us to say touches the wall.

Remember that:-

Every object has variables which describe its position. You can test 
these to change direction of travel.

Objects can tell the colour of the background they are on at the time.

hth
--
C.S.




More information about the Squeakland mailing list