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
Collision detection
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
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
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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
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
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
-
- Livecode Opensource Backer
You could also give a try to the free library that Jock made available:
Forum Post::Announcement::image collision library
Forum Post::Announcement::image collision library
collision detection
Thanks guys, this is just what I was looking for.
Dennis
Dennis