hitTest for the lazy and dull-witted...
hitTest for the lazy and dull-witted (such as myself)...
I know this thread was a hot topic a whole year ago, but i'm sure finding it interesting today. after having many of the problems expressed since Ed Mack's (Mack Daddy of HitTest) initial post, I used the simple shapFlag argument presented by "The_Xell" in Groovy.fla :
onClipEvent (mouseMove) {
if (_root.dumBell.hitTest(_root.circ._x,_root.circ._y , true)) {//checks if the circle is on the black area, not bounding box
_root.hit = true;
} else {
_root.hit = false;
}
}
I used a "dumbell" shaped object as the area to be hit and "circ" instead of the mouse position. I then CHEATED by duplicating the dumbell and putting the code on the duplicate a layer beneath, enlarging it so that the center of "circ" would hitTest before reaching the dumbell proper. works great if the dumbell doesn't have to move. Maybe I'm a dumbell for taking the less exciting route, but it was quick and simple. maybe novice actionscripters will dig it.
Ok I'm sure someone can help me
Now I had a working code for this but lost it recently but I have a character you move with the keyboard keys, and I have a wall I want to stop the character when they hit it.
Now the code I had I cant remember but it was really simple, I think it was so when the character ran into it, it had a _x=-4 and _y=-0 or something so no matter how much you tried running into the wall it would just keep pushing the character back not letting them pass through it.
I'm sure at least one of you Guru's in here know what I'm talking about
1 Attachment(s)
Hit test problem, would LOVE solution!
Hi,
this seems like THE place to ask problems to do with hit tests, so here i go.
on the attached fla file, ive got a purple box (follows the mouse) and a red box. i tried to make it so the purple box cannot pass through the red box, but i cant do it! sometimes it stops, but if you move the mouse fast it tends to go through. ive been messing with this problem for over a week and i really have no more ideas for a solution, id love it so much if someone can shine some light on how i can do this! id LOVE IT!
(if its possible to stop an MC that is stuck to the mouse pointer from going through the red MC, that would be fine as well, any solution il be so happy for!)
thanks for any help!