Object interaction

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
vtrbojevic
Posts: 14
Joined: Mon Dec 21, 2009 10:37 pm

Object interaction

Post by vtrbojevic »

Hello All,

I am starting with the Rev and would like to know how to pick up if an object (e.g. graphic) is moving over another say, graphic object. Typical example would a toxic cloud moving over the houses! By the way, I am new to object oriented programming so any explanation provided should be explained in a simple manner.

Thanks!

Regards,

Vladimir
malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Re: Object interaction

Post by malte »

Hi Vladimir,

I assume you want to check if 2 objects collide. If so, you will want to check the dictionary for "intersect" and "is in".

eg:

if intersect(graphic "cloud",graphic "house") then
-- they collided
end if

The build in handlers are not very acurate though. intersect will only check for the bounding rectangles of objects. If you need to get more fancy with the tests and are more compfortable with the rev language, you might want to take a look at animationEngine. It comes with a lot of methods to check for collisions.

All the best,

Malte
vtrbojevic
Posts: 14
Joined: Mon Dec 21, 2009 10:37 pm

Re: Object interaction

Post by vtrbojevic »

Hi Malte,

Very many thanks! That is exactly what I wanted and at this stage (prototyping) it is more than sufficient.

Best regards,

Vladimir
Post Reply