action player()
{
player = me; // copy the entity pointer to the global player pointer
... // more code
while (1){
if(mouse_left){
vec_to_angle(my.pan, target_distance);
my.tilt = 0; // don't change player's tilt angle, though
// move the player while the ditance is higher that 45
while((vec_dist(my.x,hit_coords.x) > 45){
if (vec_dist(my.x,hit_coords.x) < 90){ // if the distance from the player to the target is less than 90,transition animation to walk
ent_animatefrom(me,me,"run",50,ANM_CYCLE);
ent_blendframe(me,me,"walk",0,25);
ent_animate(my, "walk", walk_percentage, NULL); // then play the "run" animation
walk_percentage += 4 * time_step; // 7 = "run" animation speed
walk_percentage %= 100;
dist_ahead = 2 * time_step;
}
else{
dist_ahead = 7 * time_step;
ent_animate(my, "run", anim_percentage, ANM_CYCLE); // then play the "run" animation
anim_percentage += 7 * time_step; // 7 = "run" animation speed
anim_percentage %= 100;
walk_percentage = 0;
}
... // more code
c_move(me,vector(dist_ahead,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE | SCAN_TEXTURE); // move the player
wait(1);
}
}
wait(1);
}
}