|
Prev: Language
Next: D11 and reading property list from file
From: bmohnsen on 15 Jun 2008 20:57 How do you test to see if one object is inside of another. One object is a movable bitmap. The other object is an invisible shape.
From: Mike Blaustein on 15 Jun 2008 21:11 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
From: alchemist on 15 Jun 2008 21:12 You mean something like: myRect= sprite(1).rect.intersect( sprite(2).rect ) if myRect.width then -- do stuff end if Or, if by inside you meant.. well, inside: if myRect.width= sprite(2).width and myRect.height=sprite(2).height then ..... Assuming that sprite 2 is the smaller of the two sprites. "bmohnsen" <webforumsuser(a)macromedia.com> wrote in message news:g34dph$anc$1(a)forums.macromedia.com... > How do you test to see if one object is inside of another. > > One object is a movable bitmap. > The other object is an invisible shape. > >
From: fazstp on 15 Jun 2008 22:16 You could try sprite within or sprite intersects if sprite( 1 ).within( 2 ) then -- it's within else -- it's not end if
|
Pages: 1 Prev: Language Next: D11 and reading property list from file |