A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Hittest Help

  1. #1
    Junior Member
    Join Date
    Feb 2005
    Posts
    5

    Hittest Help

    I'm trying to make a hit test where if your square touches the finish square it goes to the next frame which says, "You Win"

    The actions for the square are:

    Code:
    onClipEvent (enterFrame) {
        if (this.hitTest(_root.finish)) {
            gotoAndStop(2);
        }
    }
    onClipEvent (enterFrame) {
        if (Key.isDown(Key.UP)) {
            _y -= 10;
        }
    }
    onClipEvent (enterFrame) {
        if (Key.isDown(Key.DOWN)) {
            _y -= -10;
        }
    }
    onClipEvent (enterFrame) {
        if (Key.isDown(Key.LEFT)) {
            _x -= 10;
        }
    }
    onClipEvent (enterFrame) {
        if (Key.isDown(Key.Right)) {
            _x -= -10;
        }
    }
    The movement of the square works fine but when it touches finish it doesn't do anything.

    SWF: http://www.t762.com/swf/hittest.swf
    FLA: http://www.t762.com/swf/hittest.fla

    Thanks,

    Josh

  2. #2
    _global.chosenson="flash"; chosenson's Avatar
    Join Date
    Jul 2002
    Location
    BIG APPLE
    Posts
    716
    Repaired!

    I commented the script so you will know what changes I made and why/

    Good Luck
    Attached Files Attached Files
    If you have a question, need some help, email me:chosenson

    It's always the simplest things that escape the complex mind!

    always be just

  3. #3
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    onClipEvent (enterFrame) {
    if (this.hitTest(_root.finish)) {
    _root.gotoAndStop(2);
    }

  4. #4
    Junior Member
    Join Date
    Feb 2005
    Posts
    5
    Thanks a lot.

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