It still doesn't work, like e.g. I fly really fast backwards out of the level and just keep flying. I tried to lower the jumpheight increase (e.g. to 0.002 * time_step), but that didn't fix that it also. C_move also doesn't seem to stop after the jumpheight = 0. Does maybe someone has or knows a tutorial about making a jump function)?
function jump()
{
jumpheight = 10;
my.ANIMATION += 8*time_step;
ent_animate(me,"jump",my.ANIMATION,0);
while (1)
{
jumpheight += 2*time_step;
c_move(me, vector(0,0,jumpheight), NULL, GLIDE);
if (my.ANIMATION > 50) { break;}
wait(1);
}
while (my.ANIMATION > 50)
{
// keep decreasing the velocity by same value
// that's how it works IRL
jumpheight -= 2*time_step;
c_move(me, vector(0,0,jumpheight), NULL, GLIDE);
if (jumpheight <= 0)
{
break;
jumpheight = 0;
my.ANIMATION = 0;
my.STATE = 1;
}
wait(1);
}
}