This is really simple I know, but I am scatter brained right now. I am trying to hitTest a box on all 4 sides. I named this movieClip: hitBox. The shape and size of the box is irrelevant. I just need to hitTest the x and y of the hitBox. Here is my code: (code I need help with is at the bottom. The hitTest.)
class Hero extends MovieClip
{
var speed;
function onLoad()
{
speed = 5;
}
function onEnterFrame()
{
if(Key.isDown(Key.DOWN))
{
this.gotoAndStop(2);
_y += speed;
}
else if(Key.isDown(Key.UP))
{
this.gotoAndStop(3);
_y -= speed;
}
else if(Key.isDown(Key.LEFT))
{
this.gotoAndStop(4);
_x -= speed;
}
else if(Key.isDown(Key.RIGHT))
{
this.gotoAndStop(5);
_x += speed;
}
else
{
this.gotoAndStop(1);
}
if(this.hitTest(_root.hitBox))
{
//_x ++;
//_X --;
//_x += speed; *This will hitTest the RIGHT side of the hitBox movieClip.
//_x -= speed; *This will hitTest the LEFT side of the hitBox movieClip.
}
}
}
I put slashes for trail and error. Just me trying to figure this thing out :). Thanks for the help!
Jason