Platform problems

(Total noob here.) I’m not sure if this would be better off in the games forum, but here goes.

I’m following a tutorial to make a platform game, and it all works perfectly except for one thing. If the hero is standing under a platform way above him (supposedly too high to jump up to), when he jumps he zooms right up there.


onClipEvent (enterFrame) {
if (falling == true) {
velocity += gravity;
_y += velocity;
}
for (i=0; i<99; i++) {
if (this.hitTest("_root.platform" +i)) {
platform = eval("_root.platform" +i);
}
}
if (this.hitTest(platform)) {
if (falling == true) {
_y = platform._y;
velocity = 0;
falling = false;
}
} else {
falling = true;
}

I’m completely befuddled. Does anyone know a way to prevent the hero from doing this?