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.
[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+35, true)) {
vel_y = 0;
jumping = false;
}
}
onClipEvent (enterFrame) {
this._y += 16;
if (_root.ground.hitTest(this._x, this._y+1, true)) {
this._y -= 16;
}
}
[/AS]
Any ideas on how fix either of this aspects would be a great help! Thanks in advance :).