-
check for hit test while object passes over another
Hi all, I am creating a simple game in Animate. I want to be able to pick up(drag and drop) a MovieClip(1) which when moved over another MoviClip(2) will change the opacity of the topmost layer in MovieClip(2). I know I do not explain well.
The game will involve washing dishes or a car. As a graphic of a 'sponge'(clip-1) is moved over a representation of dirty dishes or a dirty car-bubbles animate from the 'sponge' and depending on how long the 'sponge' is held over the dishes(2) then the opacity of the top layer (which will represent dirt) will drop to reveal a 'clean' layer beneath.
I have seen this exact thing done in the app my boo where the creature is washed with a sponge.
myBoo.jpg
I have a MovieClip1(sponge) and MovieClip2(dishes). I have used the Touch_begin and Touch_end events so I can drag MovieClip1 around the screen. I stored it's original position so when I let go it returns to it's original point. Works great.
I need for MoviClip1 to check whether it has passed over MovieClip2.
I have tried placing HitTest in both the Touch_begin and Touch_end functions and run a trace. My MovieClip1 only checks for a hit test when I first drag the movieClip or when I drop it, registering no collision.
Is there a way of getting movieClip1 to check for a HitTest as it passes over movieClip2.
Thanks in advance
Peace
John
Return to posts index
-
Senior Member
You can try to put the hittest into a setinterval function, which is active, when the object is moved.
- The right of the People to create Flash movies shall not be infringed. -
-
Senior Member
-
Thanks cancerinform. Doesnt work for me. Thanks for the interest and help.
-
RealMakc should I create TOUCH_MOVE function sandwiched between TOUCH_BEGIN and TOUCH_END?
I am a serious newby and trying to get some code together for very basic interactivity. Thanks for your interest.
-
Edit: I dont explain well.
Should I create a new TOUCH_MOVE function with hit test and setinterval inside of it?
-
Hi guys, I have been looking into this.
How can I create a TouchBegin which contains a hitTestObject in a loop while dragging and terminate the loop when dragging stops.
or as cancerinform suggested:
put the hittest into a setinterval function, which is active, when the object is moved.
help is much appreciated guys.
-
Senior Member
Originally Posted by ransome
Edit: I dont explain well.
Should I create a new TOUCH_MOVE function with hit test and setinterval inside of it?
I think I mean you use touchMove handler instead of setInterval.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|