HEY GUYS! what's up?

i've been doing some here and there with gravity
and this is the thing that bugs me...

i cant get the guy to land PERFECTLY on a platform

yes it lands and stops but it changes position
(like it lands on top of the platform, then in the middle)

how to fix this?

ahm, here's the script i used:

code:

if (Key.isDown(Key.SPACE) && !jumping) {
vel_y = 40;
jumping = true;
}
if (jumping == true) {
vel_y -= 6;
if (vel_y <=-40) {
vel_y = -40;
}
this._y -= vel_y;
}
if (this.hitTest(_root.ground)) {
vel_y = 0;
jumping = false;
}
if (this.hitTest(_root.ground) && !jumping) {
fall += 1;
if (fall>40) {
fall = 40;
}
this._y += fall;
}



the ground there is the instance name of my platform

yeah, can anyone help me out with this,

THNX a BUNCH!