var movement;
var allow_fire;
var p_angle;
var temp;
action state_wait ()
{
c_scan ( my.x,my.pan, vector ( 360,0,1000 ), SCAN_ENTS | IGNORE_ME );
if (event_type ==EVENT_SCAN) my.state = 2;
}
action state_attack ()
{
vec_set(temp,player.x); //you is the player
vec_sub(temp,my.x); //me is the bad buy
vec_to_angle(my.pan,temp); // now MY looks at YOU
c_move( me,vector( 4 * time_step,0,0 ), nullvector,GLIDE );
}
action enemy_act ()
{
my.state = 1;
while( my )
{
if (my.state == 2)
{
state_attack ();
}
else
{
state_wait ();
}
wait (1);
}
}