lol what wasnt i thinking.. now the astF positions are unique so now im happy... And the array is saved or loaded too .. oh and i fixed the lighting issue , that pesky light (0) doesnt do what its told , light 1 works as intended.
I hate arrays , thats why i gave it a go i need practice . They get all convoluted easily and i find it hard to visualise what im doing with them , then i miss completly obvious stuff (laughs insanely!).
Rem Project: space epic
Rem Created: Thursday, October 13, 2011
Rem ***** Main Source File *****
sync on
sync rate 0
set display mode desktop width(),desktop height(),32
set image colorkey 255,0,255
backdrop on ; color backdrop 0
hide light 0
gosub maketextures
dim sunsarray(100,1,1,1)
dim planetarray(250,1,1,1)
dim astFarray(300,1,1,1)
make object cube 1,5;hide object 1
make mesh from object 1,1
add limb 1,1,1
offset limb 1,1,0,0,-75.0
delete mesh 1
make object plain 1804,100,100
dontload = 0
perform checklist for files
print " Do you want to load your saved game? Press return to load, press space to start again.(if you start over your last save will be overwritten!)"
while dontload = 0
if spacekey() = 1 then dontload = 1
if returnkey() = 1 then dontload = 2
ENDWHILE
if file exist ("epicsuns.sef") = 0 or dontload = 1
print "No File!"
for suns = 100 to 200
make object sphere suns,1500000,32,32
position object suns,rnd(20000000)-10000000,rnd(20000000)-10000000,rnd(20000000)-10000000 'position huge sun
if object collision (suns,suns) = 1
position object suns,rnd(20000000)-10000000,rnd(20000000)-10000000,rnd(20000000)-10000000 ' when huge sun touches another sun reposition it
endif
set object light suns,1
fade object suns,139
sunsarray(suns-100,1) = object position x(suns)
sunsarray(suns-100,1,1) = object position y(suns)
sunsarray(suns-100,1,1,1) = object position z(suns)
sunsarray(suns-100) = rnd(1000); randomize rnd(500000000)
' color suns reddish,blueish,yellowish,cyanish (no greens)
if (sunsarray(suns-100)) > 500
set object emissive (suns),rgb((sunsarray(suns-100))/3,0,0)
endif
if (sunsarray(suns-100)) < 500
set object emissive (suns),rgb(0,0,(sunsarray(suns-100))/2)
endif
if (sunsarray(suns-100)) < 255
set object emissive (suns),rgb(0,sunsarray(suns-100)/4,sunsarray(suns-100))
endif
if (sunsarray(suns-100)) >745
set object emissive (suns),rgb(sunsarray(suns-100)/4,(sunsarray(suns-100)/4)/4,0)
endif
'Asteroid field positions
astFarray(suns-100)= rnd(100) + 100
astFarray(suns-100,1)= rnd(500000)-250000
astFarray(suns-100,1,1)= rnd(500000)-250000
astFarray(suns-100,1,1,1)= rnd(500000)-250000
astFarray(suns)= rnd(100) + 100
astFarray(suns,1)= rnd(500000)-250000
astFarray(suns,1,1)= rnd(500000)-250000
astFarray(suns,1,1,1)= rnd(500000)-250000
astFarray(suns+100)= rnd(100) + 100
astFarray(suns+100,1)= rnd(500000)-250000
astFarray(suns+100,1,1)= rnd(500000)-250000
astFarray(suns+100,1,1,1)= rnd(500000)-250000
randomize rnd(50000000)
NEXT suns
'scale the suns to correct size
for suns = 100 to 200
scale object suns,.7,.7,.7
NEXT suns
save array "epicsuns.sef",sunsarray()
cls
endif
if file exist ("epicplanets.sef") = 0 or dontload = 1
for planets = 2000 to 2250
if object exist(2000) = 0 then make object sphere 2000,50000,32,32 else instance object planets,2000
numsun = rnd(100)+100
position object planets,object position x(numsun)+(rnd(500000)-250000),object position y(numsun),object position z(numsun)+(rnd(500000)-250000)
if object collision (planets,numsun) = 1 or object collision (planets,planets) = 1
position object planets,object position x(numsun)+(rnd(500000)-250000),object position y(numsun),object position z(numsun)+(rnd(500000)-250000)
endif
planetarray(planets-2000) = 32+rnd(5)
planetarray(planets-2000,1) = object position x(planets)
planetarray(planets-2000,1,1) = object position y(planets)
planetarray(planets-2000,1,1,1) = object position z(planets)
NEXT planets
for planets = 2000 to 2250
scale object planets,1,1,1
texture object planets,planetarray(planets-2000)
NEXT planets
save array "epicplanets.sef",planetarray()
endif
if file exist ("epicastfields.sef") = 0 or dontload = 1
`make static asteroids
for astF = 1500 to 1800
if object exist(1500)=0 then make object sphere 1500,250 ,rnd(2)+5,rnd(2)+5 else instance object astF,1500
scale object astF,100 + rnd(50),130 + rnd(70),100 + rnd(50)
texture object astF,31
fade object astF,165
NEXT astF
save array "epicastfields.sef",astFarray()
endif
`make floating asteroids
for ast = 1000 to 1100
make object sphere ast,6,rnd(4)+3,rnd(4)+3
asteroid_obj(ast)
rotate object ast,rnd(360),rnd(360),rnd(360)
fix object pivot ast
texture object ast,31
fade object ast,130
NEXT ast
for Fplain = 1801 to 1803
make object plain Fplain,1,1
hide object Fplain
NEXT
`make bullets
for obs=500 to 700
if object exist(500)=0 then make object cube obs,100 else instance object obs,500
scale object obs,5,5,100
set object light obs,0
ghost object on obs
hide object obs
next obs
if file exist ("epicsuns.sef") = 1 and dontload <> 1
load array "epicsuns.sef",sunsarray()
for suns = 100 to 200
if object exist(suns) = 0 then make object sphere suns,1500000,32,32
set object light suns,1
fade object suns,139
position object suns,sunsarray(suns-100,1),sunsarray(suns-100,1,1),sunsarray(suns-100,1,1,1)
scale object suns,.7,.7,.7
if (sunsarray(suns-100)) > 500
set object emissive (suns),rgb((sunsarray(suns-100))/3,0,0)
endif
if (sunsarray(suns-100)) < 500
set object emissive (suns),rgb(0,0,(sunsarray(suns-100))/2)
endif
if (sunsarray(suns-100)) < 255
set object emissive (suns),rgb(0,sunsarray(suns-100)/4,sunsarray(suns-100))
endif
if (sunsarray(suns-100)) >745
set object emissive (suns),rgb(sunsarray(suns-100)/4,(sunsarray(suns-100)/4)/4,0)
endif
NEXT loadsuns
endif
if file exist ("epicplanets.sef") = 1 and dontload <> 1
load array "epicplanets.sef",planetarray()
for planets = 2000 to 2250
if object exist(2000) = 0 then make object sphere 2000,50000,32,32 else instance object planets,2000
position object planets,planetarray(planets-2000,1),planetarray(planets-2000,1,1),planetarray(planets-2000,1,1,1)
scale object planets,1,1,1
texture object planets,planetarray(planets-2000)
NEXT planets
endif
if file exist ("epicastfields.sef") = 1 and dontload <> 1
load array "epicastfields.sef",astFarray()
for astF = 1500 to 1800
if object exist(1500)=0 then make object sphere 1500,250 ,rnd(2)+5,rnd(2)+5 else instance object astF,1500
scale object astF,100 + rnd(50),130 + rnd(70),100 + rnd(50)
texture object astF,31
fade object astF,165
position object astF,astFarray(astF-1500,1),astFarray(astF-1500,1,1),astFarray(astF-1500,1,1,1)
NEXT astF
endif
position camera 0,object position x(100)+3000,object position y(100),object position z(100)
set camera range 0,1,110000000
swid=screen width()
shig=screen height()
mwid=swid/2
mhig=shig/2
gosub starrysphere
sunspawn = 100
global lasttime curtime
global elapsed#
global bullet_cur=500
global fire_delay#
curtime=timer()
lasttime=curtime
set ambient light 40
make light 1
set light range 1,10000000
do
position object 20,camera position x(0),camera position y(0),camera position z(0)
ink rgb(200,80,0),0
' FPS based game clock
cmin = min
inc GameTime,1
if GameTime => screen fps()
GameTime = 0
inc sec , 1
endif
if sec > 59 then sec = 0 ; inc min,1
if min > 59 then min = 0 ;inc hour,1
text 540,20,"{"+str$(hours)
text 600,20,":"+str$(min)
text 630,20,":"+str$(sec)
text 660,20,"} FPS :"+str$(screen fps())
check = sunspawn
ink rgb(0,70,200),0
rem sun nav
if shiftkey() = 1 then tog2=1-tog2 : wait 200
if tog2 = 0 or GameTime = 0
for scansuns = 100 to 200
xx1# = camera position x(0): xx2# = object position x(scansuns)
yy1# = camera position y(0): yy2# = object position y(scansuns)
zz1# = camera position z(0): zz2# = object position z(scansuns)
xx# = (xx1# - xx2#)
yy# = (yy1# - yy2#)
zz# = (zz1# - zz2#)
dist2# = sqrt((xx# * xx#) + (yy# * yy#) + (zz# * zz#))
if dist2# < 1300000 then (sunspawn) = (scansuns)
if object in screen (scansuns) = 1
text (object screen x(scansuns)),(object screen y(scansuns)),"S >"+str$(int(dist2#))
endif
next scansuns
endif
ink rgb(0,200,20),0
rem planet nav
if returnkey() = 1 then tog=1-tog : wait 200
if tog = 0 or GameTime = 60
for scanplanets = 2000 to 2250
x1# = camera position x(0): x2# = object position x(scanplanets)
y1# = camera position y(0): y2# = object position y(scanplanets)
z1# = camera position z(0): z2# = object position z(scanplanets)
x# = (x1# - x2#)
y# = (y1# - y2#)
z# = (z1# - z2#)
dist# = sqrt((x# * x#) + (y# * y#) + (z# * z#))
if dist# > 700000
hide object scanplanets
endif
if object in screen (scanplanets) = 1
if dist# < 700000
show object scanplanets
endif
if dist# < 900000
text (object screen x(scanplanets)),(object screen y(scanplanets)),"P >"+str$(int(dist#))
endif
endif
NEXT scanplanets
ENDIF
if placeast = 0
field1x = astFarray(sunspawn,1)
field1y = astFarray(sunspawn,1,1)
field1z = astFarray(sunspawn,1,1,1)
for firstasts = 1500 to 1599
position object firstasts,(object position x(sunspawn)+(field1x)) + (astFarray(firstasts-1500,1)/10),(object position y(sunspawn)+(field1y)) + (astFarray(firstasts-1500,1,1)/20),(object position z(sunspawn)+(field1z)) + (astFarray(firstasts-1500,1,1,1)/10)
NEXT firstasts
field2x = astFarray(sunspawn-100,1)
field2y = astFarray(sunspawn-100,1,1)
field2z = astFarray(sunspawn-100,1,1,1)
for secondasts = 1600 to 1699
position object secondasts,(object position x(sunspawn)+(field2x)) + (astFarray(secondasts-1500,1)/10),(object position y(sunspawn)+(field2y)) + (astFarray(secondasts-1500,1,1)/20),(object position z(sunspawn)+(field2z)) + (astFarray(secondasts-1500,1,1,1)/10)
NEXT secondasts
field3x = astFarray(sunspawn+100,1)
field3y = astFarray(sunspawn+100,1,1)
field3z = astFarray(sunspawn+100,1,1,1)
for thirdasts = 1700 to 1800
position object thirdasts,(object position x(sunspawn)+ (field3x)) + (astFarray(thirdasts-1500,1)/10),(object position y(sunspawn)+(field3y)) + (astFarray(thirdasts-1500,1,1)/20),(object position z(sunspawn)+(field3z)) + (astFarray(thirdasts-1500,1,1,1)/10)
if thirdasts = 1800
placeast = 1
position object 1801,object position x(sunspawn)+(field1x),object position y(sunspawn)+(field1y),object position z(sunspawn)+(field1z)
position object 1802,object position x(sunspawn)+(field2x),object position y(sunspawn)+(field2y),object position z(sunspawn)+(field2z)
position object 1803,object position x(sunspawn)+(field3x),object position y(sunspawn)+(field3y),object position z(sunspawn)+(field3z)
position object 1804,object position x(sunspawn)+(field1x),object position y(sunspawn)+(field2y),object position z(sunspawn)+(field3z)
texture object 1804,rnd(9)+21
scale object 1804,rnd(10000)+5000,rnd(10000)+5000,rnd(10000)+5000
endif
NEXT thirdasts
endif
' set the light color the same the sun color
if check <> sunspawn
placeast = 0
position light 1,object position x(sunspawn),object position y(sunspawn),object position z(sunspawn)
if (sunsarray(sunspawn-100)) > 500
color light 1, rgb((sunsarray(sunspawn-100))/3,0,0)
endif
if (sunsarray(sunspawn-100)) < 500
color light 1, rgb(0,0,(sunsarray(sunspawn-100))/2)
endif
if (sunsarray(sunspawn-100)) < 255
color light 1, rgb(0,sunsarray(sunspawn-100)/4,sunsarray(sunspawn-100))
endif
if (sunsarray(sunspawn-100)) > 745
color light 1, rgb(sunsarray(sunspawn-100)/4,(sunsarray(sunspawn-100)/4)/4,0)
endif
endif
if object in screen (sunspawn) = 1 then text (object screen x(sunspawn)-80),(object screen y(sunspawn)),"> S.System"
ink rgb(200,0,0),0
if object in screen (1801) = 1 then text object screen x(1801),object screen y(1801),"< field1"
if object in screen (1802) = 1 then text object screen x(1802),object screen y(1802),"< field2"
if object in screen (1803) = 1 then text object screen x(1803),object screen y(1803),"< field3"
ink rgb(200,60,0),0
text 20,20,"sunspawn = "+str$(sunspawn)
point object 1804,camera position x(),camera position y(),camera position z()
rem update camera pos
position camera (0),limb position x(1,1),limb position y(1,1),limb position z(1,1)
`Rotate camera with object 1 - good way to avoid camera rolling
rotate camera object angle x(1),object angle y(1),object angle z(1)
`Update skysphere position
position object 20,camera position x(),camera position y(),camera position z()
text 20,700,"speed : "+str$(speed#)
text 100,100,str$(bullet_cur)
gosub user_input_screen
gosub asteroid
gosub update_bullets
if spacekey() = 1
chp =(rnd(100)+100)
position object 1,object position x(chp),object position y(chp),object position z(chp)
endif
sync
LOOP
update_bullets:
for o=500 to 700
if object visible(o)=1
move object o,75.0*elapsed#
endif
next o
return
maketextures:
create bitmap 1,512,512
`starscape
set current bitmap 1
cls
for a=0 to 256
c=rnd(250)+5
ink rgb(c,c,c),0
if rnd(10)=1 then ink rgb(c,c*0.75,c*0.5),0
if rnd(10)=1 then ink rgb(c*0.5,c*0.75,c),0
dot rnd(512),rnd(512)
next a
get image 20,0,0,512,512,1
`nebula
for ii=21 to 30
cls
xx#=256.0
for a=0 to 256
am#=a/128.0
if am#>1.0 then am#=2.0-am#
c=(rnd(250)+5)*am#
b=((ii-20)*25)*am#
d=(255-((ii-20)*25))*am#
ink rgb(c,b,d),0
line (a+128.0),xx#,(a+128.0)+(sin(rnd(360))*16.0),xx#+(sin(rnd(360))*16.0)
inc xx#,sin(rnd(360))*3.0
next a
blur bitmap 1,4
get image ii,0,0,512,512,1
next ii
`asteroid texture
cls
for s=0 to 60
xx#=rnd(256)
yy#=rnd(256)
for a=0 to 256
am#=a/128.0
if am#>1.0 then am#=2.0-am#
c=(rnd(250)+5)*am#
ink rgb(c,c,c),0
for xo=-256 to 256 step 256
for yo=-256 to 256 step 256
line yy#+xo,xx#+yo,yy#+(sin(rnd(360))*16.0)+xo,xx#+(sin(rnd(360))*16.0)+yo
next yo
next xo
inc xx#,sin(rnd(360))*3.0
inc yy#,sin(rnd(360))*3.0
if xx#<0.0 then inc xx#,256.0
if yy#<0.0 then inc yy#,256.0
if xx#>255.0 then dec xx#,256.0
if yy#>255.0 then dec yy#,256.0
next a
next s
blur bitmap 1,4
get image 31,128,128,128+256,128+256,1
`planet textures
for i=0 to 5
cls rgb(0,0,255)
for s=0 to 20
xx#=rnd(256)
yy#=rnd(256)
for a=0 to 256
am#=a/128.0
if am#>1.0 then am#=2.0-am#
c=(rnd(250)+5)*am#
ink rgb(c/2,i*40,c/3),0
for xo=-256 to 256 step 256
for yo=-256 to 256 step 256
line yy#+xo,xx#+yo,yy#+(sin(rnd(360))*16.0)+xo,xx#+(sin(rnd(360))*16.0)+yo
next yo
next xo
inc xx#,sin(rnd(360))*3.0
inc yy#,sin(rnd(360))*3.0
if xx#<0.0 then inc xx#,256.0
if yy#<0.0 then inc yy#,256.0
if xx#>255.0 then dec xx#,256.0
if yy#>255.0 then dec yy#,256.0
next a
if s=10 then blur bitmap 1,4
next s
blur bitmap 1,3
get image 32+i,128,128,128+256,128+256,1
next i
set current bitmap 0
delete bitmap 1
return
starrysphere:
make object plain 19,15000,15000 : rotate object 19,0,0,90 : fix object pivot 19
make object cube 20,0.1
make mesh from object 19,19
texture object 20,20
ii=30
for l=1 to 90
position object 19,0,0,0
rotate object 19,l*45,l*70,rnd(360)
move object 19,19000
add limb 20,l,19
offset limb 20,l,object position x(19),object position y(19),object position z(19)
rotate limb 20,l,object angle x(19),object angle y(19),object angle z(19)
texture limb 20,l,ii
if ii>20 then dec ii,1 : scale limb 20,l,100+rnd(100),100+rnd(100),100+rnd(100)
next l
delete object 19
set object fog 20,0
set object light 20,0
set object cull 20,0
`set object texture 20,0,0
ghost object on 20,2
return
asteroid:
for ast = 1000 to 1100
if object position x (ast) <((object position x(1))-5000) then position object (ast),(object position x(1))+(rnd(10000)-5000),(object position y (1))+(rnd(10000)-5000),(object position z (1))+(rnd(10000)-5000);scale object ast,rnd(170)+50,rnd(170)+100,rnd(170)+50
if object position x (ast) >((object position x(1))+5000) then position object (ast),(object position x(1))+(rnd(10000)-5000),(object position y (1))+(rnd(10000)-5000),(object position z (1))+(rnd(10000)-5000);scale object ast,rnd(170)+50,rnd(170)+100,rnd(170)+50
if object position y (ast) <((object position y(1))-5000) then position object (ast),(object position x(1))+(rnd(10000)-5000),(object position y (1))+(rnd(10000)-5000),(object position z (1))+(rnd(10000)-5000);scale object ast,rnd(170)+50,rnd(170)+100,rnd(170)+50
if object position y (ast) >((object position y(1))+5000) then position object (ast),(object position x(1))+(rnd(10000)-5000),(object position y (1))+(rnd(10000)-5000),(object position z (1))+(rnd(10000)-5000);scale object ast,rnd(170)+50,rnd(100)+100,rnd(170)+50
if object position z (ast) <((object position z(1))-5000) then position object (ast),(object position x(1))+(rnd(10000)-5000),(object position y (1))+(rnd(10000)-5000),(object position z (1))+(rnd(10000)-5000);scale object ast,rnd(170)+50,rnd(170)+100,rnd(170)+50
if object position z (ast) >((object position z(1))+5000) then position object (ast),(object position x(1))+(rnd(10000)-5000),(object position y (1))+(rnd(10000)-5000),(object position z (1))+(rnd(10000)-5000);scale object ast,rnd(170)+50,rnd(170)+100,rnd(170)+50
if object in screen (ast) =1 then show object (ast)
if object in screen (ast) =0 then hide object (ast)
move object ast,0.3*elapsed#
rotate limb ast,0,wrapvalue(limb angle x(ast,0)+(1.0*elapsed#)),0,0
out=0
if out=0
if abs(object position x(1)-object position x(ast))>10000 then out=1
endif
if out=0
if abs(object position y(1)-object position y(ast))>10000 then out=1
endif
if out=0
if abs(object position z(1)-object position z(ast))>10000 then out=1
endif
if out=1
position object ast,object position x(1),object position y(1),object position z(1)
rotate object ast,object angle x(1),object angle y(1),object angle z(1)
move object ast,2000
rotate object ast,rnd(360),rnd(360),rnd(360)
endif
NEXT ast
return
user_input_screen:
' player HP
if playerhp < 1
wait 500
rem position object 1,object position x(100)+50000,object position y(100),object position z(100)
playerhp = 1000
ENDIF
`timer based movement
lasttime=curtime
curtime=timer()
elapsed#=(curtime-lasttime)/15.0
if elapsed#<=0.0 then elapsed#=0.00001
offset limb 1,1,0,0,mousez()/10
mx=mousex()
my=mousey()
`Inertia mouse - curvevalue is a lovely command
mx#=curvevalue(mx*1.0,mx#,10.0 / elapsed#)
my#=curvevalue(my*1.0,my#,10.0 / elapsed#)
dx#=mx#-mwid
dy#=my#-mhig
rem distance/angle equals....
D#=sqrt((dx#*dx#)+(dy#*dy#))
A#=atanfull(dx#,dy#)
rem restrict cursor to 228 from center....
Rate#=D#/228.0
if Rate#>1.0
mx#=mwid+sin(A#)*228.0
my#=mhig+cos(A#)*228.0
endif
ink rgb(255,255,0),0
rem turn left and right , up and down
if Rate# < 1.0
turnspeed# = D#*.005
endif
if Rate# > 1.0
turnspeed# = turnspeed#
ink rgb(255,0,0),0
endif
if speed# > -.01 and speed# < .01 then speed# = 0.0
circle mwid,mhig,228.0
line mwid-64,mhig,mwid+64,mhig
line mwid,mhig-15,mwid,mhig+16
`Much smoother way to do it
if D# > 20
turn object right 1,sin(a#) * ( elapsed# * turnspeed# )
pitch object down 1,cos(a#) * ( elapsed# * turnspeed# )
endif
roll object left 1,rollspeed# * elapsed#
rollspeed#=curvevalue(nrollspeed#,rollspeed#,50.0 / elapsed#)
nrollspeed#=0.0
rem thrust and roll
if leftkey() = 1 then nrollspeed#=1.0
if rightkey() = 1 then nrollspeed#=-1.0
if upkey() = 1 then inc speed#,.1 * elapsed#
if downkey()=1 then dec speed#,.1 * elapsed#
if speed# > 25.0 then speed# = 25.0
if speed# < -25.0 then speed# = -25.0
`Inertia movement
ship_lx#=object position x(1) : ship_ly#=object position y(1) : ship_lz#=object position z(1)
move object 1,speed# * elapsed#
ship_nx#=object position x(1) : ship_ny#=object position y(1) : ship_nz#=object position z(1)
ship_sx#=curvevalue(ship_nx#-ship_lx#,ship_sx#,200.0 / elapsed#)
ship_sy#=curvevalue(ship_ny#-ship_ly#,ship_sy#,200.0 / elapsed#)
ship_sz#=curvevalue(ship_nz#-ship_lz#,ship_sz#,200.0 / elapsed#)
position object 1,ship_lx#+ship_sx#,ship_ly#+ship_sy#,ship_lz#+ship_sz#
`Fire delay
dec fire_delay#,1.0*elapsed#
`Firing
if mouseclick()=1 and fire_delay#<0
fire_delay#=10
for side=0 to 1
position object bullet_cur,ship_lx#,ship_ly#,ship_lz#
rotate object bullet_cur,object angle x(1),object angle y(1),object angle z(1)
show object bullet_cur
if side=0
turn object left bullet_cur,90 : move object bullet_cur,60.0 : turn object right bullet_cur,90
else
turn object left bullet_cur,-90 : move object bullet_cur,60.0 : turn object right bullet_cur,-90
endif
inc bullet_cur,1
if bullet_cur>700 then bullet_cur=500
next side
endif
`Velocity display
ink rgb(255,128,128)+(63*16777216),0 : box mwid-10,mhig,mwid-6,mhig+(ship_sx#*64.0) : box mwid-10,mhig+(ship_sx#*64.0),mwid-6,mhig
ink rgb(128,255,128)+(63*16777216),0 : box mwid-2,mhig,mwid+2,mhig+(ship_sy#*64.0) : box mwid-2,mhig+(ship_sy#*64.0),mwid+2,mhig
ink rgb(128,128,255)+(63*16777216),0 : box mwid+6,mhig,mwid+10,mhig+(ship_sz#*64.0) : box mwid+6,mhig+(ship_sz#*64.0),mwid+10,mhig
text 20,520,"Hull Structure :"+str$(playerhp)
ink rgb(0,255,255),0 : circle mx#,my#+1,10
line mx-15,my,mx+16,my
line mx,my-15,mx,my+16
return
function asteroid_obj(obj)
LOCK VERTEXDATA FOR LIMB obj,0,1
verts=GET VERTEXDATA VERTEX COUNT()-1
rr#=10.0
for v=0 to verts
xx#=get vertexdata position x(v)
zz#=get vertexdata position z(v)
yy#=get vertexdata position y(v)
nx#=get vertexdata normals x(v)
nz#=get vertexdata normals z(v)
ny#=get vertexdata normals y(v)
r=obj+xx#+zz#+yy#
randomize r
ang=rnd(360)
inc xx#,nx#*(sin(ang)*rr#)
inc yy#,ny#*(sin(ang)*rr#)
inc zz#,nz#*(sin(ang)*rr#)
set vertexdata position v,xx#,yy#,zz#
next v
unlock vertexdata
set object smoothing obj,90
endfunction
next i want to have a go at some traffic npc's (with less cpu demand than the enemy cone ai, i have a plan to use the rotating or turning in a very limited way for the space traffic)