Intersect is not intersecting ... sometimes
Posted: Tue Nov 25, 2014 1:24 am
I have a hand grabbing a phone...it is supposed to detect the collision between hand and phone but...
When the phone is moving it works
When the phone is stationary is does not
Here is the code.
command confiscated
if intersect (image"grabber.gif",image"phone.gif","pixels")then go to last card
end confiscated
command movephone pDirection
if pDirection is "right" then
set the right of image "phone.gif" to the right of image "phone.gif" +35
if right of the image "phone.gif" >800 then
set the right of image "phone.gif" to 800
end if
else if pDirection is "left" then
set the left of image "phone.gif" to the left of image "phone.gif" -35
if left of the image "phone.gif" <-120 then
set the left of image "phone.gif" to -120
end if
end if
confiscated
end movephone
When the phone is moving it works
When the phone is stationary is does not
Here is the code.
command confiscated
if intersect (image"grabber.gif",image"phone.gif","pixels")then go to last card
end confiscated
command movephone pDirection
if pDirection is "right" then
set the right of image "phone.gif" to the right of image "phone.gif" +35
if right of the image "phone.gif" >800 then
set the right of image "phone.gif" to 800
end if
else if pDirection is "left" then
set the left of image "phone.gif" to the left of image "phone.gif" -35
if left of the image "phone.gif" <-120 then
set the left of image "phone.gif" to -120
end if
end if
confiscated
end movephone