action movePlayer()
{
player = my; //I'm the player
var dist_ahead;
var anim_percent = 0;
//vec_for_min(vFeet,my); // vFeet.z = distance from player origin to lowest vertex
while (1)
{
dist_ahead = 5*(key_w-key_s)*time_step;
c_move(my,vector(dist_ahead,0,0),nullvector,IGNORE_PASSABLE | GLIDE); // move the player
// animate the player according to its moved distance
if (dist_ahead != 0) // player is moving ahead
{
anim_percent += 1.3*dist_ahead; // 1.3 = walk cycle percentage per quant
ent_animate(my,"SlowPedal",anim_percent,ANM_CYCLE); // play the "slow pedal" animation
if(key_a)
{
// rotate the player using the [A] and [D] keys; play animation...
my.pan += 1*(key_a-key_d)*time_step;
ent_animate(my,"TurnLeft",anim_percent,ANM_ADD);
}
else if(key_d)
{
my.pan += 1*(key_a-key_d)*time_step;
ent_animate(my,"TurnRight",anim_percent,ANM_ADD);
}
}
isometric_camera();
wait(1);
}
}