Well rain_storm, it is quite simple!
All YaBASIC does is see if you (the player) is in the sights of the enemy... note that this is a square denoted as 140 by 140, this is code as:
if (alert(i)=0 and plx>=(ex(i)-70) and plx<=(ex(i)+70) and ply>=(ey(i)-70) and ply<=(ey(i)+70)) alert(i)=1
If you do enter the sights of the enemy, then it alerts them as to that you are there... then, it desides if it needs to go up, down, left or right to get to you...
After it has done this, it is now tracking you down wether which way you go... simple?
Ahh, now for the shooting... this is also easy, just make it so that the enemy fires, and then waits (reloads) and then fires again... at you
::NB// Sometimes it fires away from you because the enmey is facing left* (therefore firing left*) but you are facing up*, therfore the bullet will miss you.
if alert(i)=1 then
if ex(i)<plx then:ex(i)=ex(i)+2:edir(i)=0:fi
if ex(i)>plx then:ex(i)=ex(i)-2:edir(i)=1:fi
if ey(i)<ply then:ey(i)=ey(i)+2:edir(i)=2:fi
if ey(i)>ply then:ey(i)=ey(i)-2:edir(i)=3:fi
if (ecount(i)=0 and eshot(i)=0) then
eshot(i)=1
efire(i)=1
fi
fi
if efire(i)=1 then
if eshot(i)=1 then
esdir(i)=edir(i)
esx(i)=ex(i):esy(i)=ey(i)
eshot(i)=2
elsif eshot(i)=2 then
if esdir(i)=0 esx(i)=esx(i)+12
if esdir(i)=1 esx(i)=esx(i)-12
if esdir(i)=2 esy(i)=esy(i)+12
if esdir(i)=3 esy(i)=esy(i)-12
ecount(i)=ecount(i)+12
setrgb 1,200,0,0
fill rect esx(i)-1,esy(i)-1,esx(i)+1,esy(i)+1
if ecount(i)>=250 then:eshot(i)=0:ecount(i)=0:efire(i)=0fi
elsif eshot(i)=3 then
ecount(i)=ecount(i)+12
if ecount(i)>=250 then:eshot(i)=0:ecount(i)=0:efire(i)=0:fi
fi
fi
::NB// The code is all in FOR I = 1 TO ENUM, and ends with NEXT I
Hope that helps, if you have trouble undestanding my hard to understand instructions, then just ask me which bits you need help with.