// the road is clear? then rotate the enemy towards the player
if (c_content (content_right.x, 0) + c_content (content_left.x, 0) == 2)
{
vec_set(temp, player.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan, temp); // turn the enemy towards the player
}
if (vec_dist (player.x, my.x) > 500)
{
vec_set(content_right, vector(50, -20, -15));
vec_rotate(content_right, my.pan);
vec_add(content_right.x, my.x);
if (c_content (content_right.x, 0) != 1) // this area isn't clear?
{
my.pan += 5 * time_step; // then rotate the enemy, allowing it to avoid the obstacle
}
vec_set(content_left, vector(50, 20, -15));
vec_rotate(content_left, my.pan);
vec_add(content_left.x, my.x);
if (c_content (content_left.x, 0) != 1) // this area isn't clear?
{
my.pan -= 5 * time_step; // then rotate the enemy, allowing it to avoid the obstacle
}
c_move (my, vector(10 * time_step, 0, 0), nullvector, GLIDE);
ent_animate(my, "run", run_percentage, ANM_CYCLE); // play the "run" animation
run_percentage += 6 * time_step; // "6" controls the animation speed
}