Cool looking trails now...
`Arcade Game
Sync on : Sync rate 60
Set Display mode 1024,768,16 : Hide Mouse
Set Window On : Maximize Window
Randomize Timer()
`World
stars=1000
dim starx(stars) : Dim stary(stars)
for s=1 to stars
starx(s)=rnd(screen width())
stary(s)=rnd(screen height())
next s
`Setup Ship
Dim SCX(5) : Dim SCY(5)
Dim WCX(3) : Dim WCY(3)
SX as Float : SY as Float
SA as Float : SS as Integer
SX=Screen Width()/2 : SY=Screen Height()/2 : SS=20
Speed as Float : SpdX as Float : SpdY as Float : Drag as Float
Drag=0.99
flames=20 : flamelife=30
dim flmx(flames) : dim flmy(flames)
dim flmlife(flames) : dim flmcnt(flames)
trails=20 : trllife=10
dim tpx(2) : dim tpy(2)
dim trlx(2,trails) : dim trly(2,trails)
dim trllife(trails) : dim trlcnt(trails)
shtpnts=10
dim shtpntx(2,shtpnts) : dim shtpnty(2,shtpnts)
`Setup mouse
Dim MPX(8) : Dim MPY(8)
MSD as float
`Setup enemies
enemies=10
dim enx(4,enemies) : dim eny(4,enemies)
dim ena(2,enemies) as float
for e=1 to enemies
enx(1,e)=rnd(screen width())
eny(1,e)=rnd(screen height())
ena(1,e)=wrapvalue(rnd(360))
next e
`**Main Loop**
Do
Cls
`Draw Level
ink rgb(255,255,255),0
for s=1 to stars
box starx(s),stary(s),starx(s)+1,stary(s)+1
next s
`Control & Draw Ship
ink rgb(0,255,255),0
MX=MouseX() : MY=MouseY()
If upkey()=1 then SpdX=Sin(SA)*(MSD/20) : SpdY=Cos(SA)*(MSD/20)
SpdX=SpdX*Drag : SpdY=SpdY*Drag
SX=SX+SpdX : SY=SY+SpdY
SMA=atanfull(MX-SX,MY-SY)
SA=SMA
MSD=Sqrt((MX-SX)^2+(MY-SY)^2)
SCX(1)=SX+(Sin(SA)*SS) : SCY(1)=SY+(Cos(SA)*SS)
SCX(2)=SX+(Sin(SA+120)*SS) : SCY(2)=SY+(Cos(SA+120)*SS)
SCX(3)=SX+(Sin(SA-120)*SS) : SCY(3)=SY+(Cos(SA-120)*SS)
SCX(4)=SX+(Sin(SA+135)*(SS+5)) : SCY(4)=SY+(Cos(SA+135)*(SS+5))
SCX(5)=SX+(Sin(SA-135)*(SS+5)) : SCY(5)=SY+(Cos(SA-135)*(SS+5))
Line SCX(1),SCY(1),SCX(2),SCY(2) : Line SCX(1),SCY(1),SCX(3),SCY(3) : Line SCX(2),SCY(2),SCX(3),SCY(3)
Line SCX(2),SCY(2),SCX(4),SCY(4) : Line SCX(3),SCY(3),SCX(5),SCY(5)
WCX(1)=SX+(Sin(SA)*(SS-2)) : WCY(1)=SY+(Cos(SA)*(SS-2))
WCX(2)=SX+(Sin(SA+60)*7) : WCY(2)=SY+(Cos(SA+60)*7)
WCX(3)=SX+(Sin(SA-60)*7) : WCY(3)=SY+(Cos(SA-60)*7)
Line WCX(1),WCY(1),WCX(2),WCY(2)
Line WCX(1),WCY(1),WCX(3),WCY(3)
Line WCX(3),WCY(3),WCX(2),WCY(2)
EPX=SX+(Sin(SA+180)*9) : EPY=SY+(Cos(SA+180)*9)
if SX<0 then SX=0 : SpdX=0-SpdX
If SY<0 then SY=0 : SpdY=0-SpdY
if SX>Screen Width() then SX=Screen Width() : SpdX=0-SpdX
If SY>Screen Height() then SY=Screen Height() : SpdY=0-SpdY
if upkey()=1
For f=1 to flames
flmlife(f)=flmlife(f)+rnd(3)
if flmlife(f)<flamelife
flmcnt(f)=flmcnt(f)+1
endif
if flmlife(f)>flamelife
flmcnt(f)=0
flmlife(f)=0
endif
if flmcnt(f)=1
flmx(f)=epx
flmy(f)=epy
endif
rfa1=rnd(1)
if rfa1=1 then rfa=rnd(3)
if rfa1=0 then rfa=0-rnd(3)
flmx(f)=flmx(f)-(Sin(SA+rfa)*Rnd(3))
flmy(f)=flmy(f)-(Cos(SA+rfa)*Rnd(3))
ink rgb(255-(flmlife(f)*2),(255-(flmlife(f)*int(f/2)))-(flmlife(f)*2),0),0
circ(flmx(f),flmy(f),flmlife(f)/3,flmlife(f)/3)
next f
else
for f=1 to flames
flmlife(f)=0 : flmcnt(f)=0
next f
endif
ink rgb(0,255,0),0
tpx(1)=SCX(4) : tpy(1)=SCY(4)
tpx(2)=SCX(5) : tpy(2)=SCY(5)
trlx(1,0)=tpx(1) : trly(1,0)=tpy(1)
trlx(2,0)=tpx(2) : trly(2,0)=tpy(2)
for t=1 to 2
For r=1 to trails
trllife(r)=trllife(r)+rnd(6)
if trllife(r)<trllife
trlcnt(r)=trlcnt(r)+1
endif
if trllife(r)>trllife
trlcnt(r)=0
trllife(r)=0
endif
if trlcnt(r)=1
trlx(t,r)=tpx(t)
trly(t,r)=tpy(t)
endif
line trlx(t,r),trly(t,r),trlx(t,r-1),trly(t,r-1)
circle trlx(t,trails),trly(t,trails),3
next r
next t
ink rgb(255,255,0),0
if mouseclick()=1 then shoot=1 else shoot=0
shtspc=MSD/shtpnts
shtpntx(2,0)=sx+(Sin(SA)*SS) : shtpnty(2,0)=sy+(Cos(SA)*SS)
if shoot=1
for s=1 to shtpnts
shtpntx(1,s)=SX+(Sin(SA)*(s*shtspc))
shtpnty(1,s)=SY+(Cos(SA)*(s*shtspc))
shtpntx(2,s)=curvevalue(shtpntx(1,s),shtpntx(2,s),s)
shtpnty(2,s)=curvevalue(shtpnty(1,s),shtpnty(2,s),s)
line shtpntx(2,s),shtpnty(2,s),shtpntx(2,s-1),shtpnty(2,s-1) : circle shtpntx(2,s),shtpnty(2,s),2
next s
else
for s=1 to shtpnts
shtpntx(1,s)=sx : shtpnty(1,s)=sy
shtpntx(2,s)=sx : shtpnty(2,s)=sy
next s
endif
`Mouse
MPA=wrapvalue(MPA-3)
ink rgb(255,128-(Cos(MPA)*120),0),0
Circle MX,MY,7
MPX(1)=MX+(Sin(MPA)*5) : MPY(1)=MY+(Cos(MPA)*5)
MPX(2)=MX+(Sin(MPA)*10) : MPY(2)=MY+(Cos(MPA)*10)
MPX(3)=MX+(Sin(MPA-90)*5) : MPY(3)=MY+(Cos(MPA-90)*5)
MPX(4)=MX+(Sin(MPA-90)*10) : MPY(4)=MY+(Cos(MPA-90)*10)
MPX(5)=MX+(Sin(MPA+90)*5) : MPY(5)=MY+(Cos(MPA+90)*5)
MPX(6)=MX+(Sin(MPA+90)*10) : MPY(6)=MY+(Cos(MPA+90)*10)
MPX(7)=MX+(Sin(MPA+180)*5) : MPY(7)=MY+(Cos(MPA+180)*5)
MPX(8)=MX+(Sin(MPA+180)*10) : MPY(8)=MY+(Cos(MPA+180)*10)
Line MPX(1),MPY(1),MPX(2),MPY(2)
Line MPX(3),MPY(3),MPX(4),MPY(4)
Line MPX(5),MPY(5),MPX(6),MPY(6)
Line MPX(7),MPY(7),MPX(8),MPY(8)
`Control Enemies
ensa=wrapvalue(ensa+3)
for e=1 to enemies
ena(2,e)=curveangle(ena(1,e),ena(2,e),30.0)
if ena(2,e)>wrapvalue(ena(1,e)-3) and ena(2,e)<wrapvalue(ena(1,e)+3) then ena(1,e)=wrapvalue(rnd(360))
enx(1,e)=enx(1,e)+(Sin(ena(2,e))*3)
eny(1,e)=eny(1,e)+(Cos(ena(2,e))*3)
enx(2,e)=enx(1,e)+(Sin(ensa)*10)
eny(2,e)=eny(1,e)+(Cos(ensa)*10)
enx(3,e)=enx(1,e)+(Sin(ensa+120)*10)
eny(3,e)=eny(1,e)+(Cos(ensa+120)*10)
enx(4,e)=enx(1,e)+(Sin(ensa-120)*10)
eny(4,e)=eny(1,e)+(Cos(ensa-120)*10)
ink rgb(255,255,255),0
circle enx(2,e),eny(2,e),6
circle enx(3,e),eny(3,e),6
circle enx(4,e),eny(4,e),6
circle enx(2,e),eny(2,e),4
circle enx(3,e),eny(3,e),4
circle enx(4,e),eny(4,e),4
ink rgb(255,0,0),0
circle enx(2,e),eny(2,e),5
circle enx(3,e),eny(3,e),5
circle enx(4,e),eny(4,e),5
if enx(e)<0 then enx(e)=Screen width()
if enx(e)>screen width() then enx(e)=0
if eny(e)<0 then eny(e)=screen height()
if eny(e)>screen height() then eny(e)=0
next e
`**End Loop
Sync
Loop
`**Functions**
function circ(x, y, r,t)
for i = 0 to r
h = sqrt(r*r - (i*i))
if i < r - t
thickrad = t - r
h2 = sqrt(thickrad*thickrad - (i*i))
line x - i, y - h, x - i, y - h2
line x - i, y + h2, x - i, y + h
line x + i, y - h, x + i, y - h2
line x + i, y + h2, x + i, y + h
else
line x - i, y - h, x - i, y + h
line x + i, y - h, x + i, y + h
endif
next i
endfunction
Oh yeah... comment... please
[edidit]