function up() {
var i = 0;
while(height <= 1531 && !key_x && !key_x) {
i += 0.1*time_step;
i = clamp(i,0,2);
height += i*time_step;
wait(1);
}
}
i geus you want to control it white the keys:
w = up
s = stop
x = down
and
wont make any sense because the while loop is still running and 1=1 and 2=2 so it get increased every frame