Try something like this:
- Check if the player touched the ladder
- If touched, "attach" the player to ladder
- Disable the player's normal movement
- While "attached" make sure the player is still on the ladder and check for keystrokes, move the player if necessary.
PHP Code:
//#CLIENTSIDE
function onPlayerTouchsMe() {
if (!this.ladder) {
this.ladder = true;
player.x = this.x;
setTimer(0.05);
}
}
function onTimeout() {
if (player.y in |y-1.5, y+3|) {
if (keydown(0)) player.y -= 0.15;
if (keydown(2)) player.y += 0.3;
} else {
this.ladder = false;
Movement.ReplaceAni("idle","climbidle");
Movement.ReplaceAni("walk","climb");
}
if (this.ladder) setTimer(0.05);
}