macromedia.director.lingo
[Top] [All Lists]

Re: One object inside another

Subject: Re: One object inside another
From: Mike Blaustein
Date: Sun, 15 Jun 2008 21:11:27 -0400
Newsgroups: macromedia.director.lingo


Check out the intersect() command in the help. It will tell you if one rect intersects another, and it will tell you the rect of the intersection.

if sprite(1).rect.intersect(sprite(2).rect)>rect(0,0,0,0) then
--there is some intersection
end if


if sprite(1).rect.intersect(sprite(2).rect)=sprite(1).rect then
--sprite 1 is ENTIRELY inside of sprite 2
end if


if sprite(1).rect.intersect(sprite(2).rect)=sprite(2).rect then
--sprite 2 is ENTIRELY inside of sprite 1
end if

<Prev in Thread] Current Thread [Next in Thread>