Star Freighter takes being a delivery boy to a whole new level!
done media-less in 20 lines, this shows off just what you can do
with dbp's built in features.
set display mode 800,600,32 : sync on : sync rate 0 : sync : randomize timer() : autocam off : color backdrop 0 : hide mouse : set text font "arial black" : dim state(25) : dim bonus(25)
GAMESTART: : SYNC : fuel#=10099.0 : bonus(0)=1 : for t=1 to 25 : bonus(t)=0 : state(t)=0 : next t : dest=3 : score=0 : spd=5 : nme=0 : message$=" " : for t=1 to 2000 : if object exist(t) : delete object t : endif : if mesh exist(t) : delete mesh t : endif : next t : restore : set text size 24
make object sphere 1,4 : make object cube 2,3 : make object cylinder 3,3 : scale object 3,100,200,100 : make mesh from object 2,2 : make mesh from object 3,3 : add limb 1,1,3 : offset limb 1,1,0,-3,0 : add limb 1,2,2 : add limb 1,3,2 : offset limb 1,2,-2,-1.5,0 : offset limb 1,3,2,-1.5,0 : add limb 1,4,3 : add limb 1,5,3 : scale limb 1,4,35,80,35 : scale limb 1,5,35,80,35 : offset limb 1,4,-3.5,-1.5,0 : offset limb 1,5,3.5,-1.5,0 : scale object 1,150,150,150 : xrotate object 1,270 : fix object pivot 1 : make mesh from object 10,1
make object sphere 4,5.5 : make object cone 5,4 : make mesh from object 4,5 : add limb 4,1,4 : add limb 4,2,4 : add limb 4,3,4 : offset limb 4,1,0,3,0 : offset limb 4,2,-2,-2,0 : offset limb 4,3,2,-2,0 : rotate limb 4,2,0,225,0 : rotate limb 4,3,0,45,0 : scale limb 4,1,125,160,150 : rotate object 4,270,180,0 : fix object pivot 4 : scale object 4,200,200,200 : make mesh from object 11,4
make object sphere 6,9 : add limb 6,1,2 : add limb 6,2,2 : add limb 6,3,2 : add limb 6,4,2 : add limb 6,5,2 : add limb 6,6,2 : add limb 6,7,2 : add limb 6,8,2 : for t=5 to 8 : scale limb 6,t,200,200,200 : next t : offset limb 6,1,5,0,0 : offset limb 6,2,-5,0,0 : offset limb 6,3,0,0,5 : offset limb 6,4,0,0,-5 : offset limb 6,5,9,0,0 : offset limb 6,6,-9,0,0 : offset limb 6,7,0,0,9 : offset limb 6,8,0,0,-9 : make mesh from object 12,6
make object sphere 8,10 : make mesh from object 8,8 : add limb 8,1,8 : add limb 8,2,8 : add limb 8,3,8 : add limb 8,4,8 : offset limb 8,1,-4,0,-4 : offset limb 8,2,4,0,-4 : offset limb 8,3,-4,0,4 : offset limb 8,4,4,0,4 : make mesh from object 13,8 : for t=1 to 9 : if object exist(t) : delete object t : endif : if mesh exist(t) : delete mesh t : endif : next t
for t=50 to 59 : create bitmap 1,16,16 : x=rnd(100)+50 : y=rnd(100)+50 : z=rnd(100)+50 : for u=0 to 15 : ink rgb(x+rnd(90),y+rnd(90),z+rnd(90)),0 : line 0,u,15,u : next u : for v=1 to (t-45) : dot rnd(15),rnd(15),rgb(rnd(255),rnd(255),rnd(255)) : next v : blur bitmap 1,1.75 : get image t,0,0,15,15 : delete bitmap 1 : next t : create bitmap 1,16,16 : for t=0 to 15 step 4 : for u=0 to 15 step 4
x=rnd(100)+155 : ink rgb(x,x,x),0 : box t,u,t+4,u+4 : next u : next t : get image 1,0,0,15,15 : delete bitmap 1 : make object 1,10,1 : color object 1,rgb(100,10,250) : make object sphere 5,35 : color object 5,rgb(255,0,0) : ghost object on 5 : make object box 6,1010,10,10 : make object box 7,1010,10,10 : position object 6,0,0,500 : position object 7,0,0,-500 : make object box 8,10,10,1010 : make object box 9,10,10,1010 : position object 8,500,0,0 : position object 9,-500,0,0
for t=30 to 39 : make object t,12,1 : make object t-20,11,1 : color object t-20,rgb(rnd(5)*35,130+rnd(115),rnd(5)*35) : read x,y : position object t,(x*50)-500,0,(y*50)-500 : position object t-20,(x*50)-500,0,(y*50)-500 : yrotate object t,rnd(360) : yrotate object t-20,rnd(359) : move object t-20,30+rnd(30) : next t : for t=50 to 59 : make object sphere t,40+rnd(25),25,25 : read x,y : position object t,(x*50)-500,0,(y*50)-500 : texture object t,t : xrotate object t,90 : next t : for t=1000 to 1999 : make object sphere t,1.0+(rnd(75)*.01) : position object t,rnd(1000)-500,-rnd(100),rnd(1000)-500 : next t
ink rgb(100,103,165),0 : walk#=0.0 : t1#=timer() : do : gs#=(timer()-t1#)*0.005 : t1#=timer() : center text 400,80,"STAR FREIGHTER" : center text 400,120,"Deliver time-sensitive cargo between commerce stations" : center text 400,140,"in a heavily industrialized sector of space." : center text 400,180,"Use the arrow keys to turn and thrust your ship." : center text 400,200,"Motion is frictionless, so you have to reverse thrust to stop." : center text 400,240,"Follow your Nav Beacon to the red highlighted"
center text 400,260,"space station to pick up or drop off cargo." : center text 400,300,"Watch your fuel consumption," : center text 400,320,"and look out for mining ships, planets," : center text 400,340,"and space monsters." : center text 400,380,"Trying to cross the galactic border will result" : center text 400,400,"in your immediate destruction." : center text 400,440,"Receive Bonus Fuel and Difficulty Increase Every 25,000 points." : center text 400,500,"PRESS SPACE BAR TO BEGIN"
walk#=wrapvalue(walk#+gs#) : position camera sin(walk#)*300,500,cos(walk#)*300 : point camera 0,0,0 : sync : if SPACEKEY() : exit : endif : loop : position object 1,0,0,0 : for t=1 to 90 : if object exist(t) : set object collision to boxes t : endif : next t : make object cone 2,6 : scale object 2,70,100,70 : xrotate object 2,90 : fix object pivot 2 : xv#=0.0 : zv#=0.0 : t1#=timer() : do
gs#=(timer()-t1#)*0.01 : t1#=timer() : yrotate object 1,wrapvalue(object angle y(1)+((rightkey()-leftkey())*15*gs#)) : xv#=xv#+((sin(object angle y(1))*upkey())-(sin(object angle y(1))*downkey()))*0.45*gs# : zv#=zv#+((cos(object angle y(1))*upkey())-(cos(object angle y(1))*downkey()))*0.45*gs# : fuel#=fuel#-(2.20*gs#)*(9*(upkey()+downkey())+(leftkey()+rightkey())) : for t=1 to 10 : if state(t)=0 : point object t+9,object position x(t+49),object position y(t+49),object position z(t+49) : else : point object t+9,object position x(t+29),object position y(t+29),object position z(t+29) : endif : move object t+9,spd*gs# : if object collision(t+9,t+29) : state(t)=0 : endif : if object collision(t+9,t+49) : state(t)=1 : endif : next t : position object 5,object position x(dest+29),object position y(dest+29),object position z(dest+29)
if object collision(1,dest+29) : score=score+int(POINTS#) : message$="Docked With Commerce Station. Scored "+str$(int(points#)) : inc fuel#,250.0 : a=dest : repeat : dest=rnd(9)+1 : until dest<>a : a=object position x(1) : b=object position z(1) : c=object position x(dest+29) : d=object position z(dest+29) : points#=sqrt( (a-c)*(a-c) + (b-d)*(b-d) )*(11.5+nme) : endif : points#=points#-(gs#*5*spd) : if points#<0.0 : points#=0.0 : endif
f=object collision(1,0) : if f>5 and f<500 : xv#=-xv# : zv#=-zv# : position object 1,object position x(1)+xv#,0,object position z(1)+zv# : if f<30 or f>39 : dec fuel#,25.0*object size(f) : message$="COLLISION!" : if f>9 and f<20 : position object f,object position x(f+20),object position y(f+20),object position z(f+20) : endif : else : xv#=xv#/2.0 : zv#=zv#/2.0 : endif : endif
for t=6 to 9 : color object t,rgb(rnd(255),rnd(255),rnd(255)) : next t : L=score/25000 : if bonus(L)=0 : bonus(L)=1 : fuel#=fuel#+1500.0+1000.0*L : inc SPD : inc nme,2 : message$="Bonus Fuel Awarded" : endif : for t=50 to 59 : zrotate object t,object angle z(t)+(gs#*(t-49)*0.37) : next t : position object 1,object position x(1)+xv#,0,object position z(1)+zv# : position camera object position x(1),object position y(1)+375,object position z(1) : point camera object position x(1),object position y(1),object position z(1) : position object 2,object position x(1),object position y(1),object position z(1) : point object 2,object position x(dest+29),object position y(dest+29),object position z(dest+29) : move object 2,15
for t=1 to nme : x=t+70 : if object exist(x)=0 : make object x,13,1 : color object x,rgb(rnd(25)*10,0,rnd(10)*25) : repeat : position object x,rnd(600)-300,0,rnd(600)-300 : until object collision(x,0)=0 : endif : if t mod 2=0 : y=1 : else : y=-1 : endif : yrotate object x,object angle y(x)+(spd*y*gs#*0.65) : move object x,spd*gs# : next t
for t=30 to 39 : yrotate object t,object angle y(t)+gs# : next t : dec fuel#,gs# : text 0,0,"FUEL: "+str$(int(fuel#/100)) : text 0,20,"SCORE: "+str$(score) : text 0,40,"VALUE: "+str$(int(points#)) : if fuel#<1000 : center text 400,0,"LOW FUEL!" : endif : if points#<1500.0 : center text 400,40,"Hurry Up!" : endif : center text 400,20,message$
if fuel#<0 : set text size 48 : center text 400,200,"GAME OVER!" : center text 400,300,"Press ENTER to play again," : center text 400,330,"or ESCAPE to quit." : sync : repeat : until returnkey() : goto GAMESTART : endif : sync : loop
data 2,8,19,5,8,11,8,2,19,12,4,19,7,7,10,17,13,9,6,14,18,2,4,4,10,6,16,8,3,10,12,12,4,16,18,18,16,15,8,19
Code Broken Up:
set display mode 800,600,32
sync on
sync rate 0
sync
randomize timer()
autocam off
color backdrop 0
hide mouse
fuel#=10099.0
dim state(10)
dim bonus(25)
bonus(0)=1
dest=3
score=0
spd=5
nme=0
message$=" "
set text font "arial black"
set text size 24
make object sphere 1,4
make object cube 2,3
make object cylinder 3,3
scale object 3,100,200,100
make mesh from object 2,2
make mesh from object 3,3
add limb 1,1,3
offset limb 1,1,0,-3,0
add limb 1,2,2
add limb 1,3,2
offset limb 1,2,-2,-1.5,0
offset limb 1,3,2,-1.5,0
add limb 1,4,3
add limb 1,5,3
scale limb 1,4,35,80,35
scale limb 1,5,35,80,35
offset limb 1,4,-3.5,-1.5,0
offset limb 1,5,3.5,-1.5,0
scale object 1,150,150,150
xrotate object 1,270
fix object pivot 1
make mesh from object 10,1
make object sphere 4,5.5
make object cone 5,4
make mesh from object 4,5
add limb 4,1,4
add limb 4,2,4
add limb 4,3,4
offset limb 4,1,0,3,0
offset limb 4,2,-2,-2,0
offset limb 4,3,2,-2,0
rotate limb 4,2,0,225,0
rotate limb 4,3,0,45,0
scale limb 4,1,125,160,150
rotate object 4,270,180,0
fix object pivot 4
scale object 4,200,200,200
make mesh from object 11,4
make object sphere 6,9
add limb 6,1,2
add limb 6,2,2
add limb 6,3,2
add limb 6,4,2
add limb 6,5,2
add limb 6,6,2
add limb 6,7,2
add limb 6,8,2
for t=5 to 8
scale limb 6,t,200,200,200
next t
offset limb 6,1,5,0,0
offset limb 6,2,-5,0,0
offset limb 6,3,0,0,5
offset limb 6,4,0,0,-5
offset limb 6,5,9,0,0
offset limb 6,6,-9,0,0
offset limb 6,7,0,0,9
offset limb 6,8,0,0,-9
make mesh from object 12,6
make object sphere 8,10
make mesh from object 8,8
add limb 8,1,8
add limb 8,2,8
add limb 8,3,8
add limb 8,4,8
offset limb 8,1,-4,0,-4
offset limb 8,2,4,0,-4
offset limb 8,3,-4,0,4
offset limb 8,4,4,0,4
make mesh from object 13,8
for t=1 to 9
if object exist(t) : delete object t : endif
if mesh exist(t) : delete mesh t : endif
next t
for t=50 to 59
create bitmap 1,16,16
x=rnd(100)+50
y=rnd(100)+50
z=rnd(100)+50
for u=0 to 15
ink rgb(x+rnd(90),y+rnd(90),z+rnd(90)),0
line 0,u,15,u
next u
for v=1 to (t-45)
dot rnd(15),rnd(15),rgb(rnd(255),rnd(255),rnd(255))
next v
blur bitmap 1,1.75
get image t,0,0,15,15
delete bitmap 1
next t
create bitmap 1,16,16
for t=0 to 15 step 4
for u=0 to 15 step 4
x=rnd(100)+155
ink rgb(x,x,x),0
box t,u,t+4,u+4
next u
next t
get image 1,0,0,15,15
delete bitmap 1
make object 1,10,1
color object 1,rgb(100,10,250)
make object sphere 5,35
color object 5,rgb(255,0,0)
ghost object on 5
make object box 6,1010,10,10
make object box 7,1010,10,10
position object 6,0,0,500
position object 7,0,0,-500
make object box 8,10,10,1010
make object box 9,10,10,1010
position object 8,500,0,0
position object 9,-500,0,0
for t=30 to 39
make object t,12,1
make object t-20,11,1
color object t-20,rgb(rnd(5)*35,130+rnd(115),rnd(5)*35)
read x,y
position object t,(x*50)-500,0,(y*50)-500
position object t-20,(x*50)-500,0,(y*50)-500
yrotate object t,rnd(360)
yrotate object t-20,rnd(359)
move object t-20,30+rnd(30)
next t
for t=50 to 59
make object sphere t,40+rnd(25),25,25
read x,y
position object t,(x*50)-500,0,(y*50)-500
texture object t,t
xrotate object t,90
next t
for t=1000 to 1999
make object sphere t,1.0+(rnd(75)*.01)
position object t,rnd(1000)-500,-rnd(100),rnd(1000)-500
next t
ink rgb(200,200,200),0
walk#=0.0
t1#=timer()
do
gs#=(timer()-t1#)*0.01
t1#=timer()
center text 400,80,"STAR FREIGHTER"
center text 400,120,"Deliver time-sensitive cargo between commerce stations"
center text 400,140,"in a heavily industrialized sector of space."
center text 400,180,"Use the arrow keys to turn and thrust your ship."
center text 400,200,"Motion is frictionless, so you have to reverse thrust to stop."
center text 400,240,"Follow your Nav Beacon to the red highlighted"
center text 400,260,"space station to pick up or drop off cargo."
center text 400,300,"Watch your fuel consumption,"
center text 400,320,"and look out for mining ships, planets,"
center text 400,340,"and space monsters."
center text 400,380,"Trying to cross the galactic border will result"
center text 400,400,"in your immediate destruction."
center text 400,500,"PRESS SPACE BAR TO BEGIN"
walk#=wrapvalue(walk#+gs#)
position camera sin(walk#)*300,500,cos(walk#)*300
point camera 0,0,0
sync
if SPACEKEY() : exit : endif
loop
position object 1,0,0,0
for t=1 to 90
if object exist(t)
set object collision to boxes t
endif
next t
make object cone 2,6
scale object 2,70,100,70
xrotate object 2,90
fix object pivot 2
xv#=0.0
zv#=0.0
t1#=timer()
do
gs#=(timer()-t1#)*0.01
t1#=timer()
yrotate object 1,wrapvalue(object angle y(1)+((rightkey()-leftkey())*15*gs#))
xv#=xv#+((sin(object angle y(1))*upkey())-(sin(object angle y(1))*downkey()))*0.45*gs#
zv#=zv#+((cos(object angle y(1))*upkey())-(cos(object angle y(1))*downkey()))*0.45*gs#
fuel#=fuel#-(2.20*gs#)*(9*(upkey()+downkey())+(leftkey()+rightkey()))
for t=1 to 10
if state(t)=0
point object t+9,object position x(t+49),object position y(t+49),object position z(t+49)
else
point object t+9,object position x(t+29),object position y(t+29),object position z(t+29)
endif
move object t+9,spd*gs#
if object collision(t+9,t+29) : state(t)=0 : endif
if object collision(t+9,t+49) : state(t)=1 : endif
next t
position object 5,object position x(dest+29),object position y(dest+29),object position z(dest+29)
if object collision(1,dest+29)
score=score+int(POINTS#)
message$="Docked With Commerce Station. Scored "+str$(int(points#))
inc fuel#,250.0
a=dest
repeat
dest=rnd(9)+1
until dest<>a
a=object position x(1)
b=object position z(1)
c=object position x(dest+29)
d=object position z(dest+29)
points#=sqrt( (a-c)*(a-c) + (b-d)*(b-d) )*(11.5+nme)
endif
points#=points#-(gs#*5*spd)
if points#<0.0 : points#=0.0 : endif
f=object collision(1,0)
if f>5 and f<500
xv#=-xv#
zv#=-zv#
position object 1,object position x(1)+xv#,0,object position z(1)+zv#
if f<30 or f>39
dec fuel#,25.0*object size(f)
message$="COLLISION!"
if f>9 and f<20
position object f,object position x(f+20),object position y(f+20),object position z(f+20)
endif
else
xv#=xv#/2.0
zv#=zv#/2.0
endif
endif
for t=6 to 9
color object t,rgb(rnd(255),rnd(255),rnd(255))
next t
L=score/25000
if bonus(L)=0
bonus(L)=1
fuel#=fuel#+1500.0+1000.0*L
inc SPD
inc nme,2
message$="Bonus Fuel Awarded"
endif
for t=50 to 59
zrotate object t,object angle z(t)+(gs#*(t-49)*0.37)
next t
position object 1,object position x(1)+xv#,0,object position z(1)+zv#
position camera object position x(1),object position y(1)+375,object position z(1)
point camera object position x(1),object position y(1),object position z(1)
position object 2,object position x(1),object position y(1),object position z(1)
point object 2,object position x(dest+29),object position y(dest+29),object position z(dest+29)
move object 2,15
for t=1 to nme
x=t+70
if object exist(x)=0
make object x,13,1
color object x,rgb(rnd(25)*10,0,rnd(10)*25)
repeat
position object x,rnd(600)-300,0,rnd(600)-300
until object collision(x,0)=0
endif
if t mod 2=0
y=1
else
y=-1
endif
yrotate object x,object angle y(x)+(spd*y*gs#*0.65)
move object x,spd*gs#
next t
for t=30 to 39
yrotate object t,object angle y(t)+gs#
next t
dec fuel#,gs#
text 0,0,"FUEL: "+str$(int(fuel#/100))
text 0,20,"SCORE: "+str$(score)
text 0,40,"VALUE: "+str$(int(points#))
if fuel#<1000 : center text 400,0,"LOW FUEL!" : endif
if points#<1500.0 : center text 400,40,"Hurry Up!" : endif
center text 400,20,message$
if fuel#<0
set text size 40 : center text 400,200,"GAME OVER!" : sync : wait 5000 : end
endif
sync
loop
data 2,8,19,5,8,11,8,2,19,12,4,19,7,7,10,17,13,9,6,14,18,2,4,4,10,6,16,8,3,10,12,12,4,16,18,18,16,15,8,19
My high score today:
88,065
waht's yours?