This content has been marked as final. Show 3 replies
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
if sprite(1).rect.intersect(sprite(2).rect)=sprite(1).rect then
--sprite 1 is ENTIRELY inside of sprite 2
if sprite(1).rect.intersect(sprite(2).rect)=sprite(2).rect then
--sprite 2 is ENTIRELY inside of sprite 1
You mean something like:
myRect= sprite(1).rect.intersect( sprite(2).rect )
if myRect.width then
-- do stuff
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" <firstname.lastname@example.org> wrote in message
> 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.
You could try sprite within or sprite intersects
if sprite( 1 ).within( 2 ) then
-- it's within
-- it's not