dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [HELP] No collision when cursor not moving

Threaded View

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    8

    [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);
    }
    Last edited by thebangzats; 03-28-2011 at 12:08 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center