Sunday, June 24, 2012

[Action Script] shapeFlag hitTest still using the bounding box? June,2012

On one frame of my game, I have two movie clips. One is the boundary, which is a big block of paint with an empty path erased into it. The other is a player, who is meant to walk through the path. I'm trying to use a shapeflag hitTest so that I dont need to create tons of separate hitTests in order to make the player stay inside the path. My problem is that this current code is still using the boundary's box to determine the hitTest. Does anybody know why this is?

Code: onClipEvent(enterFrame) {
        if(this.hitTest(_root.dude.body._x,_root.dude.body._y,true)) {       
                        _root.left=false;
                        _root.right=false;
                        _root.up=false;
                        _root.down=false;
          } else {
                          _root.left=true;
                        _root.right=true;
                        _root.up=true;
                        _root.down=true;
          }
}(I'm also using a separate movieclip inside the player called "body" for the hitTest since the players head is big and in the code for the player's movement, left, right, up or down need to be true for the player to move)
shapeFlag hitTest still using the bounding box?

Related Post



0 comments: