action enemy_action()// attached to the dummy enemy that is sensitive to player's sword
{

my.healthpoints = 50; // give the enemies few health points - they'll die immediately
while (my.healthpoints > 0) // still alive?
{
vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp); // rotate towards the player at all times
my.tilt = 0;
wait (1);
}
my.passable = on; // the corpse can't be hit by the sword from now on; the enemy is dead here
snd_play (dead_wav, 50, 0); // sword sound
while (my.skill10 < 99)
{
ent_animate(my, "death", my.skill10, null);
my.skill10 += 4 * time_step; // "death" animation speed
wait (1);
}
my.transparent = on;
my.alpha = 100;
while (my.alpha > 0)
{
my.alpha -= 4 * time_step;
wait (1);
}
ent_remove (my);
}