Page 1 of 1

Collision detection

Posted: Mon Dec 18, 2006 7:25 pm
by dgm
Hi,

I want to make a simple game like pong and would like to know how I can detect that the moving image has hit the wall ( an object or edge of the card) so it can bounce back. I have looked without success in the documentation.

Thanks,

Dennis

Posted: Mon Dec 18, 2006 9:41 pm
by Mark
Hi Dennis,

You could check whether the topleft, topright, bottomleft or bottomright of your moving object is within the object that depicts the wall. You could also check out Animation Engine.

Best,

Mark

Posted: Tue Dec 19, 2006 8:39 am
by malte
Hi Dennis,

to check ball / paddle and ball / brick collisions the built in intersect() function should be what you need.

if intersect(button "ball",button "paddle") then
-- collision occured
end if

If you need more sophisticated collision detection and/or asynchronous movement, AnimationEngine can help you.

All the best,

Malte

Posted: Tue Dec 19, 2006 9:44 am
by marielle
You could also give a try to the free library that Jock made available:

Forum Post::Announcement::image collision library

collision detection

Posted: Wed Dec 20, 2006 5:35 am
by dgm
Thanks guys, this is just what I was looking for.

Dennis