...1. make map/background/leve(whatever you call it)
2. load your ship
Naah, make it fully in DBP source
Better than X3
rem Scorpyo 2007
_______TOP_________:
set display mode 1024,748,32
set current bitmap 0
SYNC ON
SYNC RATE 60
backdrop on
hide mouse
color backdrop rgb(10,10,10)
autocam off
set global collision off
set text opaque
set ambient light 70
x#=0.0:y#=30.0:z#=0.0:flyflag=0:camrot=0:camdist#=-400:newcamdist#=-300
cx#=0.0:cy#=0.0:cz#=-300.0:ax#=0.01:ay#=0.01:az#=0.01
zline=-100:landsize=0:printflag=2:camdist2#=-400
c2x#=0.0:c2z#=0.0:camhgt2=200:camrot2=0:camlen2=0:camdist2=-300
rotrate#=0.1:flyflag=1:pitch#=0.0:turn#=0.0:crot=0:takeoff=0
targetspeed#=0.0:speed#=0.0:start=0:up#=0.0:fixedrotrate#=0.2
gosub makeship
gosub make_earth
gosub makesky
gosub makelane
gosub makeplanet
gosub makeplanets
gosub makebuildings
gosub makeradar
gosub makeplanetbuildings
gosub makecameras
gosub startcam
backdrop off
_____DO_LOOP______:
do
if inkey$()="?" then gosub inquiry
if inkey$()="k" then gosub keyinfo
if inkey$()="p" then printflag=1:wait 10
if inkey$()="P" then printflag=2:wait 10
if inkey$()="e" then sync rate 0
if inkey$()="E" then sync rate 60
if inkey$()="r" then gosub reset
if inkey$()="v" then gosub checkalign
if inkey$()="q" and targetspeed#<100.0 then targetspeed#=targetspeed#+0.2
if flyflag=1 and speed#<targetspeed# then speed#=speed#+0.03
if inkey$()="a" and targetspeed#>-20.0 then targetspeed#=targetspeed#-0.2
if flyflag=1 and targetspeed#<speed# then speed#=speed#-0.03
if inkey$()="s" then start=1
if inkey$()="l" then start=0
if start=1 and takeoff=0 then gosub startflight
if start=0 and takeoff=1 then gosub land
if takeoff=1 then move object 10,speed#
if printflag=1 then gosub printdata1
if printflag=2 then gosub printdata2
gosub turnradar
gosub Shipcontrol
gosub update_camera
rem position object 3,x#,y#,z#
gosub updatecamera2
gosub checkheight2
SYNC
loop
______ROUTINES_____:
Shipcontrol:
if speed#>0.0 and speed#<0.01 then speed#=0.0:targetspeed#=0.0
if speed#<0.0 and speed#>-0.01 then speed#=0.0:targetspeed#=0.0
if inkey$()="1" then rotrate#=0.1
if inkey$()="2" then rotrate#=0.2
if inkey$()="3" then rotrate#=0.3
if inkey$()="4" then rotrate#=0.4
rem ---- Control Player ----
x#=object position x(10)
y#=object position y(10)
z#=object position z(10)
if inkey$()="ù" then targetspeed#=0.0:speed#=0.0
if inkey$()="à" then speed#=60.0:targetspeed#=60.0
if inkey$()="ò" then targetspeed#=0.0
if upkey()=1 and pitch#<0.5 then pitch#=pitch#+0.03:turn#=0.0
if downkey()=1 and pitch#>-0.5 then pitch#=pitch#-0.03:turn#=0.0
if rightkey()=1 and turn#<0.5 then turn#=turn#+0.03:pitch#=0.0
if leftkey()=1 and turn#>-0.5 then turn#=turn#-0.03:pitch#=0.0
if inkey$()="5" then crot=1:pitch#=0.0:turn#=0.0
if inkey$()="6" then crot=0:rotrate#=0.2:pitch#=0.0:turn#=0.0
if sin(az#)<=0.0 and cos(az#)>=0.0 then gosub acontrol
if sin(az#)>=0.0 and cos(az#)>=0.0 then gosub bcontrol
if sin(az#)>=0.0 and cos(az#)<=0.0 then gosub ccontrol
if sin(az#)<=0.0 and cos(az#)<=0.0 then gosub dcontrol
return
acontrol:
if inkey$()="," then rotrate#=fixedrotrate#:az#=wrapvalue(az#-rotrate#)
if inkey$()="." then rotrate#=fixedrotrate#:az#=wrapvalue(az#+rotrate#)
roll#=abs(sin(az#))*rotrate#
if pitch#>0.02
ax#=wrapvalue(ax#+rotrate#-roll#)
ay#=wrapvalue(ay#+roll#)
if crot=0 then pitch#=pitch#-0.01:rotrate#=pitch#
if crot=1 then rotrate#=pitch#
endif
if pitch#<-0.02
ax#=wrapvalue(ax#-rotrate#+roll#)
ay#=wrapvalue(ay#-roll#)
if crot=0 then pitch#=pitch#+0.01:rotrate#=-pitch#
if crot=1 then rotrate#=-pitch#
endif
if turn#>0.02
ay#=wrapvalue(ay#+rotrate#-roll#)
ax#=wrapvalue(ax#-rotrate#+(rotrate#-roll#))
if crot=0 then turn#=turn#-0.01:rotrate#=turn#
if crot=1 then rotrate#=turn#
endif
if turn#<-0.02
ay#=wrapvalue(ay#-rotrate#+roll#)
ax#=wrapvalue(ax#+rotrate#-(rotrate#-roll#))
if crot=0 then turn#=turn#+0.01:rotrate#=-turn#
if crot=1 then rotrate#=-turn#
endif
return
bcontrol:
if inkey$()="," then rotrate#=fixedrotrate#:az#=wrapvalue(az#-rotrate#)
if inkey$()="." then rotrate#=fixedrotrate#:az#=wrapvalue(az#+rotrate#)
roll#=abs(sin(az#))*rotrate#
if pitch#>0.02
ax#=wrapvalue(ax#+rotrate#-roll#)
ay#=wrapvalue(ay#-roll#)
if crot=0 then pitch#=pitch#-0.01:rotrate#=pitch#
if crot=1 then rotrate#=pitch#
endif
if pitch#<-0.02
ax#=wrapvalue(ax#-rotrate#+roll#)
ay#=wrapvalue(ay#+roll#)
if crot=0 then pitch#=pitch#+0.01:rotrate#=-pitch#
if crot=1 then rotrate#=-pitch#
endif
if turn#>0.02
ay#=wrapvalue(ay#+rotrate#-roll#)
ax#=wrapvalue(ax#+rotrate#-(rotrate#-roll#))
if crot=0 then turn#=turn#-0.01:rotrate#=turn#
if crot=1 then rotrate#=turn#
endif
if turn#<-0.02
ay#=wrapvalue(ay#-rotrate#+roll#)
ax#=wrapvalue(ax#-rotrate#+(rotrate#-roll#))
if crot=0 then turn#=turn#+0.01:rotrate#=-turn#
if crot=1 then rotrate#=-turn#
endif
return
ccontrol:
if inkey$()="," then rotrate#=fixedrotrate#:az#=wrapvalue(az#-rotrate#)
if inkey$()="." then rotrate#=fixedrotrate#:az#=wrapvalue(az#+rotrate#)
roll#=abs(sin(az#))*rotrate#
if pitch#<-0.02
ax#=wrapvalue(ax#+rotrate#-roll#)
ay#=wrapvalue(ay#+roll#)
if crot=0 then pitch#=pitch#+0.01:rotrate#=-pitch#
if crot=1 then rotrate#=-pitch#
endif
if pitch#>0.02
ax#=wrapvalue(ax#-rotrate#+roll#)
ay#=wrapvalue(ay#-roll#)
if crot=0 then pitch#=pitch#-0.01:rotrate#=pitch#
if crot=1 then rotrate#=pitch#
endif
if turn#<-0.02
ay#=wrapvalue(ay#+rotrate#-roll#)
ax#=wrapvalue(ax#-rotrate#+(rotrate#-roll#))
if crot=0 then turn#=turn#+0.01:rotrate#=-turn#
if crot=1 then rotrate#=-turn#
endif
if turn#>0.02
ay#=wrapvalue(ay#-rotrate#+roll#)
ax#=wrapvalue(ax#+rotrate#-(rotrate#-roll#))
if crot=0 then turn#=turn#-0.01:rotrate#=turn#
if crot=1 then rotrate#=turn#
endif
return
dcontrol:
if inkey$()="," then rotrate#=fixedrotrate#:az#=wrapvalue(az#-rotrate#)
if inkey$()="." then rotrate#=fixedrotrate#:az#=wrapvalue(az#+rotrate#)
roll#=abs(sin(az#))*rotrate#
if pitch#<-0.02
ax#=wrapvalue(ax#+rotrate#-roll#)
ay#=wrapvalue(ay#-roll#)
if crot=0 then pitch#=pitch#+0.01:rotrate#=-pitch#
if crot=1 then rotrate#=-pitch#
endif
if pitch#>0.02
ax#=wrapvalue(ax#-rotrate#+roll#)
ay#=wrapvalue(ay#+roll#)
if crot=0 then pitch#=pitch#-0.01:rotrate#=pitch#
if crot=1 then rotrate#=pitch#
endif
if turn#<-0.02
ay#=wrapvalue(ay#+rotrate#-roll#)
ax#=wrapvalue(ax#+rotrate#-(rotrate#-roll#))
if crot=0 then turn#=turn#+0.01:rotrate#=-turn#
if crot=1 then rotrate#=-turn#
endif
if turn#>0.02
ay#=wrapvalue(ay#-rotrate#+roll#)
ax#=wrapvalue(ax#-rotrate#+(rotrate#-roll#))
if crot=0 then turn#=turn#-0.01:rotrate#=turn#
if crot=1 then rotrate#=turn#
endif
return
update_camera:
if inkey$()="H" then set camera view 2,0,0,800,600
if inkey$()="h" then set camera view 2,600,10,800,160
if inkey$()="b" then camdist#=-400
if inkey$()="n" then camdist#=-1000
if inkey$()="m" then camdist#=-2000
if inkey$()="v" then camdist#=-300
gosub reset_rotation
gosub rotate_1
gosub rotate_2
gosub objectroll
position camera x#+cx#,y#+cy#+camhgt,z#+cz#
set camera to object orientation 10
return
reset_rotation:
yrotate object 10,0.0
xrotate object 10,0.0
zrotate object 10,0.0
yrotate camera 0,0.0
xrotate camera 0,0.0
zrotate camera 0,0.0
camdist2#=camdist#
newcamdist#=camdist2#
ay1#=0.0
ax1#=0.0
cx#=sin(ay1#)*camdist2#
cz#=cos(ay1#)*camdist2#
position camera x#+cx#,y#+cy#,z#+cz#
return
rotate_1:
xrotate object 10,ax#
cy#=sin(ax#)*-camdist2#
cz#=cos(ax#)*camdist2#
newcamdist#=cos(ax#)*camdist2#
rem xrotate camera ax#
return
rotate_2:
yrotate object 10,ay#
camdist2#=newcamdist#
cx#=sin(ay#)*camdist2#
cz#=cos(ay#)*camdist2#
rem yrotate camera ay#
return
objectroll:
roll object right 10,az#
return
rem camera
startcam:
set camera fov 60
set camera range 10,10100000
position camera cx#,cy#,cz#
return
reset:
x#=0.0:y#=30.0:z#=0.0:flyflag=0:camrot=0:camdist#=-300:newcamdist#=-300
cx#=0.0:cy#=0.0:cz#=-300.0:ax#=0.0:ay#=0.0:az#=0.0
zline=-100:landsize=0:printflag=2:up#=0.0
c2x#=0.0:c2z#=0.0:camhgt2=200:camrot2=0:camlen2=0
rotrate#=0.2:flyflag=0:pitch#=0.0:turn#=0.0:crot=0:fixedrotrate#=0.2
targetspeed#=3.0:speed#=0.0:start=0
position object 10,x#,y#,z#
xrotate object 10,ax#
yrotate object 10,ay#
zrotate object 10,az#
camdist#=-300
newcamdist#=-300
cx#=sin(ay#)*camdist#
cz#=cos(ay#)*camdist#
cy#=0.0
position camera x#+cx#,y#+cy#,z#+cz#
yrotate camera ay#
xrotate camera ax#
set camera to object orientation 10
return
startflight:
if speed#<>0.0 then return
move object up 10,0.2
y#=y#+0.2
up#=up#+0.2
position camera x#+cx#,y#+cy#+camhgt,z#+cz#
if up#>60 then takeoff=1:speed#=0.1:targetspeed#=3.0
return
land:
if speed#>1.0 or speed#<-1.0 then return
move object down 10,0.2
y#=y#-0.2
up#=up#-0.2
position camera x#+cx#,y#+cy#+camhgt,z#+cz#
if up#<0.1 then takeoff=0:speed#=0.0:targetspeed#=0.0
return
turnradar:
ray#=wrapvalue(ray#+0.2)
yrotate object 5,ray#
return
_____PRINT_____:
printdata1:
set cursor 0,0
print "polys ",statistic(1)
print "frame rate=",screen fps()
print "x#= ",x#
print "y#= ",y#
print "z#= ",z#
print
print "ax#= ",ax#
print "ay#= ",ay#
print "az#= ",az#
print
print "rotrate#=",rotrate#
print "roll#=",roll#
print "pitch#=",pitch#
print "turn#=",turn#
print "crot=",crot
print "camdist#=",camdist#
print "speed#= ",speed#
print "targetspeed#= ",targetspeed#
print
return
printdata2:
set cursor 0,0
print "polys ",statistic(1)
print "frame rate=",screen fps()
print "roll#=",roll#
print
print "speed#= ",speed#
print "targetspeed#= ",targetspeed#
print "relative height=",rheight#
print
print "press k for controls info"
return
keyinfo:
set cursor 0,400
print "s = take off - start flying"
print "l = land - dock"
print "r = reset start position"
print "q / a = accel./decel."
print "§ = freeze speed - @ = slow down till stop"
print "# = instant high speed"
print "arrows =: up-down-left-right"
print " . and , = roll"
print "5 , 6 = toggle flight control mode"
print "1,2,3,4 = toggle control sensitivity"
print "v,b,n,m = toggle main camera views"
print "<,z,Z,x,X,c,C = second cam controls"
print "mouse = second cam controls"
return
_____MAKE_SCENERY___:
makeship:
cls rgb(100,10,10)
fgcolor=RGB(0,0,50)
bgcolor=RGB(0,0,50)
ink fgcolor,bgcolor
line 0,0,128,0
line 0,1,128,1
line 0,30,128,30
line 0,31,128,31
line 64,0,64,64
line 0,32,64,0
line 64,0,128,32
line 0,64,128,64
line 0,65,128,65
line 0,127,128,127
line 0,128,128,128
line 0,0,0,128
line 0,1,0,128
line 128,0,128,128
line 127,0,127,128
get image 4,0,0,128,128
make object box 10,80,40,100
set object 10,1,1,0,1,1,1,1
scale object 10,100,100,200
position object 10,x#,y#,z#
texture object 10,4
gosub resetblack
return
makesky:
cls rgb(5,5,5)
fgcolor=RGB(255,255,255)
bgcolor=RGB(255,255,255)
ink fgcolor,bgcolor
for n=1 to 3000
dtx=rnd(1000):dty=rnd(1000)
dot dtx,dty
next n
get image 3,0,0,256,256,1
make object sphere 3,10000000.0,6,6
set object 3,1,1,0,0,0,0,0
texture object 3,3
scale object texture 3,10,10
position object 3,-landsize/2,0,-landsize/2
gosub resetblack
return
makelane:
cls rgb(200,10,10)
fgcolor=RGB(0,0,50)
bgcolor=RGB(0,0,50)
ink fgcolor,bgcolor
box 20,20,108,108
get image 7,0,0,128,128
for n=101 to 120
make object cube n,20
texture object n,7
next n
for n=101 to 109
position object n,-160,0,zline
zline=zline+100
next n
zline=-100
for n=110 to 118
position object n,160,0,zline
zline=zline+100
next n
position object 119,100,0,zline
position object 120,-100,0,zline
gosub resetblack
return
makeplanets:
cls rgb(60,60,10)
fgcolor=RGB(40,0,0)
bgcolor=RGB(40,0,0)
ink fgcolor,bgcolor
line 0,0,128,128
line 0,128,128,0
get image 8,0,0,128,128
randomize 1
for n=200 to 203
px=rnd(200000)-50000:py=rnd(400000)+2000:pz=rnd(300000)-50000
make object sphere n,rnd(1000)+2000
position object n,px,py,pz
texture object n,8
scale object texture n,6,6
next n
gosub resetblack
return
makeplanet:
cls rgb(160,90,20)
line 0,0,250,0
line 0,0,250,250
line 0,250,250,0
get image 5,0,0,256,256
make object sphere 300,20000,12,12
position object 300,-100000,100000,200000
set object 300,1,1,0
texture object 300,5
scale object texture 300,10,10
return
make_earth:
rem create texture
cls rgb(20,80,20)
inkcolor#=rgb(255,255,255)
line 0,0,0,250
line 1,1,1,250
line 2,2,2,250
line 0,0,250,0
line 1,1,250,1
line 2,2,250,2
line 0,0,250,250
line 0,250,250,0
rem next n
get image 2,0,0,250,250
make object sphere 30,5000000,36,36
set object 30,1,1,0
texture object 30,2
scale object texture 30,20,20
position object 30,0,-2500000,0
return
makebuildings:
rem
xbuildarea=0:zbuildarea=0
make object box 400,400,600,200
xb=-1000:zb=400:gosub checkheight1
position object 400,xbuildarea+xb,300-height#-50,zbuildarea+zb
make object box 401,400,300,200
xb=-900:zb=800:gosub checkheight1
position object 401,xbuildarea+xb,150-height#-50,zbuildarea+zb
make object box 402,200,400,100
xb=-1100:zb=1000:gosub checkheight1
position object 402,xbuildarea+xb,200-height#-50,zbuildarea+zb
make object box 403,200,800,200
xb=-1000:zb=1400:gosub checkheight1
position object 403,xbuildarea+xb,400-height#-50,zbuildarea+zb
rem
xbuildarea=6000:zbuildarea=6000
make object box 404,400,600,200
xb=-1000:zb=400:gosub checkheight1
position object 404,xbuildarea+xb,300-height#-50,zbuildarea+zb
make object box 405,400,300,200
xb=-900:zb=800:gosub checkheight1
position object 405,xbuildarea+xb,150-height#-50,zbuildarea+zb
make object box 406,200,400,100
xb=-1100:zb=1000:gosub checkheight1
position object 406,xbuildarea+xb,200-height#-50,zbuildarea+zb
make object box 407,200,800,200
xb=-1000:zb=1400:gosub checkheight1
position object 407,xbuildarea+xb,400-height#-50,zbuildarea+zb
rem
xbuildarea=2000:zbuildarea=2000
make object box 408,400,600,200
xb=-1000:zb=400:gosub checkheight1
position object 408,xbuildarea+xb,300-height#-50,zbuildarea+zb
make object box 409,400,300,200
xb=-900:zb=800:gosub checkheight1
position object 409,xbuildarea+xb,150-height#-50,zbuildarea+zb
make object box 410,200,400,100
xb=-1100:zb=1000:gosub checkheight1
position object 410,xbuildarea+xb,200-height#-50,zbuildarea+zb
make object box 411,200,800,200
xb=-1000:zb=1400:gosub checkheight1
position object 411,xbuildarea+xb,400-height#-50,zbuildarea+zb
rem
xbuildarea=-8000:zbuildarea=-8000
make object box 412,400,600,200
xb=-1000:zb=400:gosub checkheight1
position object 412,xbuildarea+xb,300-height#-50,zbuildarea+zb
make object box 413,400,300,200
xb=-900:zb=800:gosub checkheight1
position object 413,xbuildarea+xb,150-height#-50,zbuildarea+zb
make object box 414,200,400,100
xb=-1100:zb=1000:gosub checkheight1
position object 414,xbuildarea+xb,200-height#-50,zbuildarea+zb
make object box 415,200,800,200
xb=-1000:zb=1400:gosub checkheight1
position object 415,xbuildarea+xb,400-height#-50,zbuildarea+zb
rem
xbuildarea=7000:zbuildarea=-8000
make object box 416,400,600,200
xb=-1000:zb=400:gosub checkheight1
position object 416,xbuildarea+xb,300-height#-50,zbuildarea+zb
make object box 417,400,300,200
xb=-900:zb=800:gosub checkheight1
position object 417,xbuildarea+xb,150-height#-50,zbuildarea+zb
make object box 418,200,400,100
xb=-1100:zb=1000:gosub checkheight1
position object 418,xbuildarea+xb,200-height#-50,zbuildarea+zb
make object box 419,200,800,200
xb=-1000:zb=1400:gosub checkheight1
position object 419,xbuildarea+xb,400-height#-50,zbuildarea+zb
cls rgb(10,10,100)
fgcolor=RGB(0,0,0)
ink fgcolor,bgcolor
for m=10 to 160 step 40
for n=10 to 190 step 40
box n,m,n+10,m+20
next n
next m
get image 20,0,0,200,200
for n=400 to 419
texture object n,20
next n
gosub resetblack
return
makeplanetbuildings:
xbuildarea=-97960:ybuildarea=109200:zbuildarea=195903
make object box 420,400,600,200
xrotate object 420,340
position object 420,xbuildarea-1000,ybuildarea+200,zbuildarea+400
make object box 421,400,300,200
xrotate object 421,340
position object 421,xbuildarea-900,ybuildarea+150,zbuildarea+800
make object box 422,200,400,100
xrotate object 422,340
position object 422,xbuildarea-1100,ybuildarea+200,zbuildarea+1000
make object box 423,200,800,200
xrotate object 423,340
position object 423,xbuildarea-1000,ybuildarea+400,zbuildarea+1400
for n=420 to 423
texture object n,20
next n
return
makeradar:
cls rgb(80,80,200)
get image 10,0,0,128,128
make object cone 5,100
set object 5,1,1,0
texture object 5,10
scale object 5,100,30,100
xrotate object 5,240
fix object pivot 5
position object 5,300,210,60
make object cylinder 6,100
scale object 6,10,200,10
texture object 6,10
position object 6,300,100,60
return
checkheight1:
height#=intersect object(30,xbuildarea+xb,0,zbuildarea+zb,0,-2500000,0)
return
checkheight2:
rheight#=intersect object(30,x#,y#,z#,0,-2500000,0)
return
______OTHER_CAMERAS______:
makecameras:
make camera 2
set camera fov 2,60
set camera range 2,10,10100000
set camera view 2,700,10,900,160
return
updatecamera2:
if inkey$()="<" then gosub resetcam2
if inkey$()="z" then camhgt2=camhgt2+2
if inkey$()="Z" then camhgt2=camhgt2-2
if inkey$()="x" then camlen2=camlen2+2
if inkey$()="X" then camlen2=camlen2-2
if inkey$()="c" then camrot2=camrot2+2
if inkey$()="C" then camrot2=camrot2-2
mymousex=mousemovex()
if mymousex>0 then camrot2=camrot2+2:position mouse 400,300
if mymousex<0 then camrot2=camrot2-2:position mouse 400,300
mymousey=mousemovey()
if mymousey>0 then camhgt2=camhgt2+5:position mouse 400,300
if mymousey<0 then camhgt2=camhgt2-5:position mouse 400,300
mymousez=mousemovez()
if mymousez>0 then camdist2=camdist2+20:position mouse 400,300
if mymousez<0 then camdist2=camdist2-20:position mouse 400,300
c2x#=newxvalue(x#,ay#+camrot2,camdist2)
c2z#=newzvalue(z#,ay#+camrot2,camdist2)
position camera 2,c2x#,y#+camhgt2,c2z#
point camera 2,x#,y#+camlen2,z#
return
resetcam2:
camhgt2=200:camrot2=0:camlen2=0:camdist2=-300
return
checkalign:
camlen2=0:camrot2=0:camhgt2=0
return
inquiry:
set cursor 0,400
print "xcoord?":input x#
print "ycoord?":input y#
print "zcoord?":input z#
position object 10,x#,y#,z#
return
______OTHER______:
resetblack:
fgcolor=RGB(255,255,255)
bgcolor=RGB(0,0,0)
ink fgcolor,bgcolor
return
end
Just kidding...an abandoned engine attempt got stuck on a walk on sphere issue.
Feel free to take any ideas
cheers