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
Intersect is not intersecting ... sometimes
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 34
- Joined: Mon Nov 03, 2014 7:11 pm
Re: Intersect is not intersecting ... sometimes
Presumably you mean with "when the phone is stationary it does not" that you are moving the hand.
Obviously the rect of the hand is not continuously updated.
We have no chance to judge what's wrong because we don't know how you do this (by which handler).
Obviously the rect of the hand is not continuously updated.
We have no chance to judge what's wrong because we don't know how you do this (by which handler).
shiftLock happens
-
- Posts: 34
- Joined: Mon Nov 03, 2014 7:11 pm
Re: Intersect is not intersecting ... sometimes
both the hand and the phone move at the same time. However if the player stops and does not move the phone then the intersect does not work. shouldn't the intersect work every time regardless of whether one of the objects is moving or not?
Re: Intersect is not intersecting ... sometimes
The intersect state will occur whenever there is an intersection. You need to check for this state in an appropriate way. You are testing for an intersect every time the movephone handler runs, when you execute the confiscated command. Do you execute the same confiscated command within the hand moving handler?
-
- Posts: 34
- Joined: Mon Nov 03, 2014 7:11 pm
Re: Intersect is not intersecting ... sometimes
No but I will give that a try and get back to you