So I came along another problem. After implementing my crouch function and my footsteps (thanks to badapple for his code contribution), I came up to my final basic movement system thingo. Jumping.

I've searched around but surprisingly I haven't found any code. I'm trying not to use any templates for my game, as I'm trying to learn as I go.

Anyway, I'm using the movement code from one of the workshops right now, so it'll probably help if I list the code here along with what I've tried to do:

Movement Code
Code:

vec_set (temp.x, my.x); // trace 10,000 quants below the player
temp.z -= 10000;
temp.z = -c_trace (my.x, temp.x, ignore_me | ignore_passable | use_box);
temp.x = movement_speed * (key_w - key_s) * time;
temp.y = movement_speed * (key_a - key_d) * 0.6 * time;
c_move (my, temp.x, nullvector, ignore_passable | glide);



Jump Code
Code:

function jump()
{
var playerisjumping;
var jumpgravity = 5;
while (playerisjumping == 0)
{
c_move (player,nullvector,vector(0,0,jumpgravity*time),IGNORE_YOU|GLIDE);
jumpgravity -= 0.01;
if (jumpgravity == 0)
{
playerisjumping = 1;
}
sleep(0.01);
}
playerisjumping = 0;
jumpgravity = 5;
}



Simple second attempt at jump code
Code:

function jump()
{
c_move (player,nullvector,vector(0,0,jumpgravity*time),IGNORE_YOU|GLIDE);
}



The only thing I can notice is that the player is put down on the ground after each sleep command since the movement code isn't cancelled out, but I haven't really been able to fix that.