[HELP] No collision when cursor not moving
So I'm making a simple maze game. I tried AS2 and as you can see in my older thread that it failed.
With AS3 I managed to resolve the problem I said in the thread, but now I face a new problem.
If you open this .swf there's an explanation, but I'll do one here too:
http://www.mediafire.com/?w71ctp8ejwi3h5b
If you hit the wall, it will register a collision as it should. Goes the same for the exit. But if you look to the upper left, there's a rotating rectangle. If you hit the rotating rectangle, it will register a collision IF YOUR CURSOR MOVED.
That's right, if you freeze the cursor in place as the rectangle comes sweeping in, it WILL NOT register a collision, meaning if it were a maze game, people could cheat by just staying still.
THANKS IN ADVANCE. HELP WILL BE GREATLY APPRECIATED.
I forgot, here's the code:
Code:
stop();
stage.addEventListener(MouseEvent.MOUSE_MOVE, detectHits);
function detectHits(event:MouseEvent) {
if (wall.hitTestPoint(mouseX,mouseY,true)) {
gotoAndPlay("440","Menu");
stage.removeEventListener(MouseEvent.MOUSE_MOVE, detectHits);
}
else if (gate.hitTestPoint(mouseX,mouseY,true)) {
gotoAndStop("2","Main");
stage.removeEventListener(MouseEvent.MOUSE_MOVE, detectHits);
}
else if (sqr1.hitTestPoint(mouseX,mouseY,true)) {
gotoAndPlay("440","Menu");
stage.removeEventListener(MouseEvent.MOUSE_MOVE, detectHits);
}