action main_player() //not player, since it's a global pointer
{
var dist_ahead, walk_percentage=0, stand_percentage=0;
while(1)
{
my.pan += 19*(key_a-key_d)*time_step;
dist_ahead = 2*(key_w-key_s)*time_step;
if(dist_ahead) //if dist is NOT zero
{
dist_ahead = sign(dist_ahead)*(abs(dist_ahead) + 0.5); // adapt the speed on slopes
c_move(me,vector(dist_ahead,0,0),NULL,GLIDE); // move the player
ent_animate(me,"walk",walk_percentage,ANM_CYCLE); // walk animation loop
walk_percentage += 4 * time_step;
stand_percentage = 0;
}
else
{
ent_animate(me,"stand",stand_percentage, 0); //standing still animation, now allows stand to have "figit-ing"
stand_percentage += 4 * time_step;
walk_percentage = 0;
}
if((key_space)&&(me.z<=20)) c_move(me,vector(0,0,+10),NULL,GLIDE); //only add jump when "on-ground"( Im guessing my.z=20 is on the ground? )
else if(me.z > 20) c_move(me,vector(0,0,-0.8),NULL,GLIDE); //fall now allows you to land "on" things
//
camera.x = my.x - 60; // keep the camera 200 quants behind the player
camera.y = my.y; // using the same y with the player
camera.z = my.z+30; // and place it at z = 700 quants
camera.tilt = -25; // make it look downwards
wait (1);
}
}