Version for the poor sods (me included) who're stuck with DBC:
`set display mode 1280, 1024, 32
sync on
sync rate 0
color backdrop rgb(0,0,0)
load image "black.png", 1, 1
sprite 1, 0, 0, 1
set sprite 1, 0, 1
size sprite 1, screen width(), screen height()
a# = 32.0
`set sprite alpha 1, a#
draw to front
backdrop off
PLANETS = 3
ASTEROIDS= 250
PLANETMASS# = 0.1
ASTEROIDMASS# = 0.001
Dim PlanetPos#(PLANETS, 3)
Dim AsteroidData#(ASTEROIDS, 3, 3)
for i = 1 to PLANETS
`make object sphere i, 3, 12, 12
make object sphere i, 100
scale object i,3,12,12
color object i, rgb(96, 96, 255)
PlanetPos#(i, 1) = rnd(80)-40
PlanetPos#(i, 2) = rnd(80)-40
PlanetPos#(i, 3) = rnd(80)-40
position object i, PlanetPos#(i, 1), PlanetPos#(i, 2), PlanetPos#(i, 3)
next i
for j = 1 to ASTEROIDS : i = j + 100
`make object sphere i, 1.5, 8, 8
make object sphere i,100
scale object i,1.5,8,8
color object i, rgb(96, 255, 96)
AsteroidData#(j, 1, 1) = rnd(80)-40
AsteroidData#(j, 1, 2) = rnd(80)-40
AsteroidData#(j, 1, 3) = rnd(80)-40
position object i, AsteroidData#(j, 1, 1), AsteroidData#(j, 1, 2), AsteroidData#(j, 1, 3)
next j
autocam off
angle# = 0.0
frameTime# = 1.0
startTime = timer()
KeyDown = 0
do
frameTime# = (frameTime# * 0.8) + ((timer() - startTime) * 0.2) : startTime = timer()
for i = 1 to ASTEROIDS
fX# = 0.0 : fY# = 0.0 : fZ# = 0.0
for j = 1 to PLANETS
DistX# = PlanetPos#(j, 1) - AsteroidData#(i, 1, 1)
DistY# = PlanetPos#(j, 2) - AsteroidData#(i, 1, 2)
DistZ# = PlanetPos#(j, 3) - AsteroidData#(i, 1, 3)
Dist# = sqrt((DistX#^2) + (DistY#^2) + (DistZ#^2))
if Dist# < 1.0 then Dist# = 1.0
Grav# = ASTEROIDMASS# * PLANETMASS# * (Dist#*Dist#) * 0.05
inc fX#, Grav# * DistX# / Dist#
inc fY#, Grav# * DistY# / Dist#
inc fZ#, Grav# * DistZ# / Dist#
next j
AsteroidData#(i, 2, 1)=AsteroidData#(i, 2, 1)+ (fX# / ASTEROIDMASS#) * frameTime# * 0.001
AsteroidData#(i, 2, 2)=AsteroidData#(i, 2, 2)+ (fY# / ASTEROIDMASS#) * frameTime# * 0.001
AsteroidData#(i, 2, 3)=AsteroidData#(i, 2, 3)+ (fZ# / ASTEROIDMASS#) * frameTime# * 0.001
AsteroidData#(i, 1, 1)=AsteroidData#(i, 1, 1)+ AsteroidData#(i, 2, 1) * frameTime# * 0.001
AsteroidData#(i, 1, 2)=AsteroidData#(i, 1, 2)+ AsteroidData#(i, 2, 2) * frameTime# * 0.001
AsteroidData#(i, 1, 3)=AsteroidData#(i, 1, 3)+ AsteroidData#(i, 2, 3) * frameTime# * 0.001
position object i + 100, AsteroidData#(i, 1, 1), AsteroidData#(i, 1, 2), AsteroidData#(i, 1, 3)
next i
inc angle#, frameTime# * 0.0225
position camera sin(angle#) * 150.0, sin(angle#) * 10.0, cos(angle#) * 150.0
point camera 0, 0, 0 : set point light 0, sin(angle#) * 100.0, sin(angle#) * 20.0, cos(angle#) * 100.0
if keystate(52)
inc a#, frameTime# * 0.016
if a# > 255 then a# = 255
`set sprite alpha 1, a#
else
if keystate(51)
dec a#, frameTime# * 0.016
if a# < 1.0 then a# = 1.0
` set sprite alpha 1, a#
endif
endif
text 10, 10, "FPS: " + str$(screen fps())
text 10, 30, "Alpha: " + str$(a#)
sync
loop
Basically, you can't use the inc command on arrays in DBC, and 'Make Object Sphere' only has a radius argument, rather than X-radius, Y-radius and Z-radius or whatever it actually is.