A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    May 2005
    Location
    Leeds UK
    Posts
    79

    Simple hitest question

    Hi there!

    I have always used the "if(object.hitTest(object2)){};" hitTest BUT;

    I am workin on a platform game and I want to use the one which tests the shape rather than bounding box. I have no idea how to use it. I have tried the following;

    if(this.hitTest(_root.mov._x,_root.mov._y,true){};

    if(_root.mov.hitTest(this._x,this._y,true){};

    if(_root.mov.hitTest(x,y,true){};

    none of these have worked for me

    PLEASE HELP ME!!!

    Thanks

  2. #2
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    if(this.hitTest(_root.mov._x,_root.mov._y,true){};

    if(_root.mov.hitTest(this._x,this._y,true){};

    if(_root.mov.hitTest(x,y,true){};

    All of these are wrong, try one of these, depending on the desired effect:

    if (this.hitTest(_root.mov._x, _root.mov._y, true)) {
    trace('Collision detected!');
    }

    if (_root.mov.hitTest(this._x, this._y, true)) {
    trace('Collision detected!');
    }
    http://www.birchlabs.co.uk/
    You know you want to.

  3. #3
    Custom User Title Incrue's Avatar
    Join Date
    Feb 2004
    Posts
    974
    The problem was just a single )

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