Now the enemies shoot back at you!
sync on:sync rate 0:cls:hide mouse:r#=270:x#=320:y#=240:dim m#(100,3):e=0:x=1:y=2:r=3:dim e#(30,3):ink rgb(255,0,0),0:circle 15,15,15:get image 1,0,0,31,31:s#=6:wait=2:for i=1 to 30:e#(i,x)=rnd(640)
dim em#(30,8,3):dim wait(30):e#(i,y)=rnd(480):e#(i,r)=rnd(359):e#(i,e)=1:next i:do:cls:dec wait:if wait<=0 and spacekey()=1:wait=2:found=0:for i=1 to 100:if found=0 and m#(i,e)=0:m=i:found=1:endif
next i:m#(m,x)=x#:m#(m,y)=y#:m#(m,r)=r#:m#(m,e)=1:endif:inc x#,(upkey()-downkey())*s#*cos(r#):inc y#,(upkey()-downkey())*s#*sin(r#):inc r#,(rightkey()-leftkey())*8:if x#<15:x#=15:endif:if y#<15:y#=15
endif:if x#>625:x#=625:endif:if y#>465:y#=465:endif:ink rgb(0,0,255),0:circle x#,y#,15:line x#,y#,x#+15*cos(r#),y#+15*sin(r#):ink rgb(255,0,0),0:for i=1 to 30:if e#(i,e)=1
paste image 1,e#(i,x)-15,e#(i,y)-15:line e#(i,x),e#(i,y),e#(i,x)+15*cos(e#(i,r)),e#(i,y)+15*sin(e#(i,r)):endif:next i:ink rgb(0,255,0),0:for n=1 to 30:if e#(n,e)=1:for m=1 to 100
if m#(m,e)=1 and abs(m#(m,x)-e#(n,x))<20 AND abs(m#(m,y)-e#(n,y))<20:m#(m,e)=0:e#(n,e)=0:endif:next m:endif:next n:for i=1 to 100:if m#(i,e)=1:x1#=m#(i,x):y1#=m#(i,y):r1#=m#(i,r):inc x1#,10*cos(r1#)
inc y1#,10*sin(r1#):line x1#,y1#,x1#+10*cos(r1#),y1#+10*sin(r1#):if x1#<0 or y1#<0 or x1>640 or y1#>480:m#(i,e)=0:endif:m#(i,x)=x1#:m#(i,y)=y1#:endif:next i:ec=0:for n=1 to 30:if e#(n,e)=1:inc ec
tan#=wrapvalue(atanfull(y#-e#(n,y),x#-e#(n,x))):if tan#>180:dec tan#,360:endif:r1#=wrapvalue(e#(n,r)):if r1#>180:dec r1#,360:endif:if tan#-r1#<0-180:dec r#,360:endif:if tan#-r1#>180:dec tan#,360
endif:if r1#>tan#:dec r1#,5:endif:if r1#<tan#:inc r1#,5:endif:wait(n)=wait(n)-1:if abs(r1#-tan#)<15 and wait(n)<=0:wait(n)=30:found=0:for mi=1 to 8:if found=0 and em#(n,mi,0)=0:found=1:me=mi:endif
next mi:em#(n,me,0)=1:em#(n,me,x)=e#(n,x):em#(n,me,y)=e#(n,y):em#(n,me,r)=e#(n,r):endif:e#(n,r)=r1#:d#=sqrt((e#(n,x)-x#)^2+(e#(n,y)-y#)^2):if d#>150:e#(n,x)=e#(n,x)+6*cos(r1#):e#(n,y)=e#(n,y)+6*sin(r1#)
endif:if d#<100:e#(n,x)=e#(n,x)-6*cos(r1#):e#(n,y)=e#(n,y)-6*sin(r1#):endif:for t=1 to 30:if e#(t,e)=1 and t<>n:d#=sqrt((e#(n,x)-e#(t,x))^2+(e#(n,y)-e#(t,y))^2):if d#<30:tan#=atanfull(e#(t,y)-e#(n,y),e#(t,x)-e#(n,x))
o#=(30-d#)/2.0:e#(n,x)=e#(n,x)-o#*cos(tan#):e#(n,y)=e#(n,y)-o#*sin(tan#):endif:endif:next t:if e#(n,x)<15:e#(n,x)=15:endif:if e#(n,y)<15:e#(n,y)=15:endif:if e#(n,x)>625:e#(n,x)=625:endif:if e#(n,y)>465
e#(n,y)=465:endif:endif:ink rgb(255,155,155),0:for mc=1 to 8:if em#(n,mc,0)=1:r1#=em#(n,mc,r):em#(n,mc,x)=em#(n,mc,x)+10*cos(r1#):em#(n,mc,y)=em#(n,mc,y)+10*sin(r1#)
line em#(n,mc,x),em#(n,mc,y),em#(n,mc,x)+10*cos(r1#),em#(n,mc,y)+10*sin(r1#):IF em#(n,mc,x)<0 OR em#(n,mc,y)<0 OR em#(n,mc,x)>640 OR em#(n,mc,y)>480:em#(n,mc,0)=0:endif:endif:next mc:next n
ink rgb(0,0,255),0:print "Enemies remaining:",ec:if ec=0:exit:endif:sync:loop:cls:center text 320,200,"YOU WON!"
www.CyberLuke.com