Intersect Point

Andrew Kluthe andrew at ctech.me
Fri Oct 25 02:24:53 CEST 2013


I don't work on this kind of stuff in livecode, is there a message that
gets sent when two objects touch in livecode?

 I believe this a good case for a pub-sub library like Andre Garzia's.

When the objects intersect have it throw a trigger to a specific callback
with its location in a parameter array and have that callback function
receive the location of the intersection and place the explosion sprite at
that location. http://www.andregarzia.com/posts/en/pubsub/




On Thu, Oct 24, 2013 at 7:03 PM, Ender Nafi Elekcioglu
<endernafi at gmail.com>wrote:

> Hi all,
>
> I’m coding a very simple game just for an animation test of a bigger
> project.
> If two objects collide, they should merge and explode.
> For the objects, I’m using buttons whose icons set to the id’s of some
> png’s.
> For the explosion I use a separate *sprite* button.
> _ if intersect(object1, object2, “opaque pixels”)
> __ set the loc of spriteButton to collisionPoint
> __ send “animateTheExplosion” to me in 1 milliseconds
> __ play explosionSound
> __ delete object1
> __ delete object2
>
>
> But in this workflow, I need the *collisionPoint*.
> As far as I know, the intersect function doesn’t provide this info; just
> true or false.
>
> I have two questions about this:
> 1. What is the least expensive {time-consuming, processor-consuming, etc.}
> way to calculate the collision point of the objects?
> 2. Doesn’t the engine already have to calculate this collision point to
> determine if there is an intersection?
> What if the built-in intersect function provides us this point instead of
> true-false?
> Then we could construct our handler like this:
> *if intersect(object1, object2) is not empty then…*
> instead of
> *if intersect(object1, object2) then…*
> Is this a useful feature request to submit?
>
>
> Best,
>
> ~ Ender Nafi
> ~… together, we’re smarter …~
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




-- 
Regards,

Andrew Kluthe
andrew at ctech.me


More information about the use-livecode mailing list