|
-
[HELP] Hittest on Rotating Shapes /w Mouse
HELP!
I've googled for hours and found nothing. I did find a lot but none involved hittesting with a mouse cursor.
Here goes:
I'm trying to make a simple maze game, so far it works, I die when I hit squares and rectangles, but I die incorrectly when hitting a rotating rectangle.
Because it rotates, the bounding box is larger and a normal hittest sees bounding boxes, meaning it won't work.
Could you help?
Make it so that my mouse can go near the rotating rectangle without dying until I actually touch the actual rectangle instead of the bounding box.
THANKS IN ADVANCE.
-
what is the code you are using? are you using an event listener. or are you doing a hittest to an object on the mouse? an event listener might be useful in this situation, place it on a movieclip inside the clip housing the rotating rectangle. I do not know how accurate this is, but look into Add.eventListener.
also, a rollover might work.
-
Just the simplest one, I'm not on my home computer right now so I can't type it here, but it doesn't really matter what code I'm using now, I can change it completely for the sake of being able to hittest on irregular shapes.
And no, it's not a hittest to an object on the mouse, the object IS the mouse.
And no, just making it a button and using rollover doesn't work either.
So yeah, anything that works, I'd love that.
EDIT:
Okay, this is the hittest for the wall, which is stationary
Code:
on (rollOver) {
_root.gotoAndPlay("Menu");
}
And this to the various non-stationary objects, including the exit to the next level
Code:
stop();
onEnterFrame = function ()
{
if (gate.hitTest(_root._xmouse, _root._ymouse))
{
_root.gotoAndPlay("lvl2");
}
if (sqr1.hitTest(_root._xmouse, _root._ymouse))
{
_root.gotoAndPlay("Menu");
}
if (sqr2.hitTest(_root._xmouse, _root._ymouse))
{
_root.gotoAndPlay("Menu");
}
if (sqr3.hitTest(_root._xmouse, _root._ymouse))
{
_root.gotoAndPlay("Menu");
}
};
Last edited by thebangzats; 03-28-2011 at 06:02 AM.
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
|