PDA

View Full Version : hitTest help


Pedal-kid
07-01-2008, 12:24 AM
I have a stickman named "dude" and a ground named "ground"
When the stickman hits the ground, I wont him to stop falling down, whats wrong with this code?

onEnterFrame=function() {
gravity=0.4;
dude._y+=gravity;
if (dude.hitTest(ground)==true) {
gravity=0;
}



}

robin105
07-01-2008, 11:51 PM
Try this...

onEnterFrame = function () {
gravity = 0.4;
_root.dude._y += gravity;
if (_root.dude.hitTest(_root.ground) == true) {
gravity = 0;
}
};