A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: hitTest

  1. #1
    Senior Member
    Join Date
    May 2004
    Posts
    627

    hitTest

    This is a script that I am doing on a game. I try to put this script on the char so he will fall on the platform rather than falling through the platform and out of the stage.
    But it doesnt work.
    Any help will be great



    if (_root.ground.hitTest(this._x, this._y, true) && jumping==1) {
    this._y += 2;
    trace("char hits platform");
    jumping = 0;
    falling = 0;

    }

  2. #2
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    that code only check's the char's _x and _y position which is just a single point. Simplest is to use the boundingbox test instead:

    Code:
    if (_root.ground.hitTest(this) && jumping==1) {
    this._y += 2;
    trace("char hits platform");
    jumping = 0;
    falling = 0;
    
    }
    /Mirandir

  3. #3
    Senior Member
    Join Date
    May 2004
    Posts
    627
    thanks so much. It works

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