I’ve created a platformer game. The problem is that sometimes my character rides to high on the platforms as well as too low. He even ends up falling through sometimes. The platforms are all in one mc. Below is the jumping and platform script.
why does that mc have two onenterframe events?
anyway if i got u correctly this may help, let me know if it does
[AS]
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP) && !jumping) {
vel_y = 36;
jumping = true;
}
if (jumping == true) {
vel_y -= 2;
if (vel_y<=-15) {
vel_y = -15;
}
this._y -= vel_y;
}
if (_root.ground.hitTest(this._x, this._y+(_height/2), true)) {
vel_y = 0;
jumping = false;
}
this._y += 16;
if (_root.ground.hitTest(this._x, this._y+(_height/2), true)) {
this._y -= 16;
}
}
[/AS]
whoa…no that made it even more messed up. My guy would speed up and slow down while jumping and wouldn’t stay on almost any of the platforms… Do you think it’s because I have two onClipEvent’s that my script is messing up? I have no clue what’s wrong…
Creating engaging and entertaining content for designers and developers since 1998.