I am writing a player code based on the "lite-c without templates" example. the basic key movements work fine,
however I have implemented a custom jumping code which is acting funny. I use c_trace to see how far the player is to the
ground. when it is not touching the gravity function kicks in.
I wrote the jumping to only jump when the ground is detected
however, pushing the button constantly causes the player to stay in the air. here is the action code,

action player_me()
{
if(!player)
{
wait(1); //while player loads
}

// Only use one player_me action per game
player = my;
set(my,TRANSLUCENT);
player_health();//make player health = 100 first time only


// Player does stuff while player still has health
if (player.skill10>1)
{
my.alpha = 0;// Player can't see self
move_player();
set_camera_fps();// First person perspective, see CameraStuff.c
player_gravity();

my.min_z *= 0.5;

while(player.skill10>1)
{//add apparent gravity
if(my.floor_dist>0)
{
player_gravity();
}

c_trace(my.x,vector(0,0,my.z-10),IGNORE_ME | IGNORE_PASSABLE | USE_BOX);
if(trace_hit==1)
{
dist_down = my.z - target.z;
}
else
{
dist_down = 0;
}

if (player.skill10 <1)
{
break;
}
wait(0.5);
}//end while
}//end if

if (player.skill10 <1) //player dies
{
player_dies();
}

} then the gravity code,

function player_gravity()
{
while(1)
{
c_move(player,vector(0,0,-5*time_step),nullvector,IGNORE_PASSABLE);
wait(1);
}

} and finally the jump code,

function player_jump()
{
var timer = 7;

while(1)
{
c_move(player,vector(0,0,30*time_step),nullvector,GLIDE|IGNORE_PASSABLE);
timer -= 1;

if(timer<=0)
{
break;
}
wait(1);
}
}