okay here is a sun and rings for saturn, but nothin new about ugly uranus
Rem Project: PLanetOrbits
Rem Created: 27.06.2005 22:06:34
Rem ***** Main Source File *****
color backdrop 0
hide light 0
make light 1
set light range 1,100000
color light 1,250,250,250
set normalization on
Type Vec
x As Float
y As Float
z As Float
EndType
Type Planet
name As String
mass As Float
diameter As Float
orbitRadius As Float
orbitAngle As Vec
orbitPosition As Vec
orbitSpeed As Float
daySpeed As Float
EndType
#CONSTANT AU = 150
#CONSTANT Multi = 4 `this is just to speed things up and resize planets
`Earth orbit is equal to 150 million km
`SO multiply below orbit radius with au
DIM Planets(9,7) AS Planet
Planets(0,0).name = "Sun"
Planets(0,0).orbitRadius = 0.0
Planets(0,0).orbitSpeed = 0.0
Planets(0,0).diameter = 1390000
Planets(1,0).name = "Mercury"
Planets(1,0).orbitRadius = 0.387
Planets(1,0).orbitSpeed = 0.24
Planets(1,0).diameter = 4880
Planets(2,0).name = "Venus"
Planets(2,0).orbitRadius = 0.72
Planets(2,0).orbitSpeed = 0.62
Planets(2,0).diameter = 12103.6
Planets(3,0).name = "Earth"
Planets(3,0).orbitRadius = 1.00
Planets(3,0).orbitSpeed = 1.00
Planets(3,0).diameter = 12756.3
Planets(3,1).name = "Moon"
Planets(3,1).orbitRadius = 384400
Planets(3,1).orbitSpeed = 12.37
Planets(3,1).diameter = 3476
Planets(4,0).name = "Mars"
Planets(4,0).orbitRadius = 1.52
Planets(4,0).orbitSpeed = 1.88
Planets(4,0).diameter = 6794
Planets(5,0).name = "Jupiter"
Planets(5,0).orbitRadius = 5.20
Planets(5,0).orbitSpeed = 11.86
Planets(5,0).diameter = 142984
Planets(6,0).name = "Saturn"
Planets(6,0).orbitRadius = 9.54
Planets(6,0).orbitSpeed = 29.46
Planets(6,0).diameter = 120536
Planets(7,0).name = "Your Anus"
Planets(7,0).orbitRadius = 19.218
Planets(7,0).orbitSpeed = 83.75
Planets(7,0).diameter = 51118
Planets(8,0).name = "Neptune"
Planets(8,0).orbitRadius = 30.110
Planets(8,0).orbitSpeed = 163.73
Planets(8,0).diameter = 49532
Planets(9,0).name = "Pluto"
Planets(9,0).orbitRadius = 39.545
Planets(9,0).orbitSpeed = 248.03
Planets(9,0).diameter = 2274
for a = 1 to 9
make object sphere a, Planets(a,0).diameter / 100 / Multi
set object ambience a, 0
next a
make object sphere 10, Planets(3,1).diameter / 100 / Multi
set object ambience 10, 0
make object sphere 11, 139000 / 100 / Multi
cls
ink rgb(255,255,0),0
box 0,0,2,2
get image 11,0,0,2,2
set object light 11, 0
texture object 11,11
ink rgb(255,255,255),0
sx# = object size x(6)*2
sz# = object size z(6)*2
make object plain 12, sx#, sz#
xrotate object 12, 90
cls
ink rgb(255,255,255),0
for rad = 10 to 100 step 5
circle 100, 100, rad
next rad
get image 12,0,0,201,201
set object light 12, 0
texture object 12,12
ink rgb(255,255,255),0
ghost object on 12,2
GOSUB Camera_Setup
GOSUB prepareGameTimers
sync on
do
GOSUB loopGameTimers
REM PLANETS
for a = 1 to 9
x# = 0 : y# = 0 : z# = 0
yrotate object a, tmr1SecC
dist# = Planets(a,0).orbitRadius * AU * Multi
Planets(a,0).orbitAngle.y = wrapvalue(Planets(a,0).orbitAngle.y + (1.0 / Planets(a,0).orbitSpeed / 10))
Planets(a,0).orbitAngle.x = 0.0
newX# = x# - sin(Planets(a,0).orbitAngle.y) * cos(Planets(a,0).orbitAngle.x) * dist#
newY# = y# - sin(Planets(a,0).orbitAngle.x) * dist#
newZ# = z# + cos(Planets(a,0).orbitAngle.y) * cos(Planets(a,0).orbitAngle.x) * dist#
position object a, newX#, newY#, newZ#
next a
REM MOONS
x# = object position x(3)
y# = object position y(3)
z# = object position z(3)
dist# = Planets(3,1).orbitRadius / 15000 * Multi
Planets(3,1).orbitAngle.y = wrapvalue(Planets(3,1).orbitAngle.y + (1.0 / Planets(3,1).orbitSpeed * 10))
Planets(3,1).orbitAngle.x = 0.0
newX# = x# + sin(Planets(3,1).orbitAngle.y) * cos(Planets(3,1).orbitAngle.x) * dist#
newY# = y# - sin(Planets(3,1).orbitAngle.x) * dist#
newZ# = z# + cos(Planets(3,1).orbitAngle.y) * cos(Planets(3,1).orbitAngle.x) * dist#
position object 10, newX#, newY#, newZ#
REM SATURN
x# = object position x(6)
y# = object position y(6)
z# = object position z(6)
position object 12, x#, y#, z#
REM DAY NIGHT CYCLE PLANETS
for a = 1 to 9
yrotate object a, wrapvalue(tmr1SecC)
next a
REM INFO
if spacekey() = 1 and textOn = 0 then textOn = 1
if textOn = 1
textOn = 2
inc textWrite
if textWrite > 1 then textWrite = 0
endif
if spacekey() = 0 then textOn = 0
if textWrite > 0
for a = 1 to 9
if object in screen(a)
text object screen x(a), object screen y(a), Planets(a,0).name
endif
next a
if object in screen(10)
text object screen x(10), object screen y(10), Planets(3,1).name
endif
endif
set cursor 0,0
print "use wasd and mouse to travel around"
print "press space to turn info on and off"
print "values are as realistic as possible from nasa"
print "i only added earths moon, maybe you would like to add the others"
GOSUB Camera_Free_Loop
sync
loop
prepareGameTimers:
`---------------------------------------------------------
REM VARIABLES
`---------------------------------------------------------
tmr1MSecS = TIMER()
tmr2MSecS = TIMER() : `if to be started in loop, make a button for this
`---------------------------------------------------------
REM FINISH GAME TIMERS
`---------------------------------------------------------
RETURN
loopGameTimers:
REM GAME Timer1
`---------------------------------------------------------
tmr1MSec = TIMER ()
tmr1MSecC = (tmr1MSec - tmr1MSecS)
tmr1SecC = tmr1MSecC / 1000
tmr1MinC = tmr1SecC / 60
tmr1HrC = tmr1MinC / 60
tmr1DayC = tmr1HrC / 24
tmr1MSec = tmr1MSecC Mod 60
tmr1Sec = tmr1SecC Mod 60
tmr1Min = tmr1MinC Mod 60
tmr1Hr = tmr1HrC Mod 24
tmr1Day = tmr1DayC
`---------------------------------------------------------
REM FINISH UPDATING TIMERS
`---------------------------------------------------------
RETURN
Camera_Setup:
dummyCam = 997
Cam_Start_X# = 0.0
Cam_Start_Y# = 0.0
Cam_Start_Z# = 0.0
MAKE OBJECT BOX dummyCam, 5, 5, 5 : HIDE OBJECT dummyCam
REM POSITION THE START CAMERA
POSITION OBJECT dummyCam, Cam_Start_X#, Cam_Start_Y#, Cam_Start_Z#
camMoveSpeed# = 1.0 : mouseSpeed = 4
SET CAMERA RANGE 0.1, 100000
RETURN
`-----------FREE CAMERA LOOP-----------
Camera_Free_Loop:
if shiftkey() > 0
inc camMoveSpeed#, 0.1
if camMoveSpeed# => 10.0 then camMoveSpeed# = 10.0
else
if camMoveSpeed# > 1.0
dec camMoveSpeed#, 0.1
if camMoveSpeed# =< 1.0 then camMoveSpeed# = 1.0
endif
endif
if keystate(17)=1 then MOVE OBJECT dummyCam, camMoveSpeed#
if keystate(30)=1 then MOVE OBJECT LEFT dummyCam, camMoveSpeed#
if keystate(31)=1 then MOVE OBJECT dummyCam, -camMoveSpeed#
if keystate(32)=1 then MOVE OBJECT RIGHT dummyCam, camMoveSpeed#
rem camera rotation
camAngX# = wrapvalue((mousemovey() / mouseSpeed) + camAngX#)
camAngY# = wrapvalue((mousemovex() / mouseSpeed) + camAngY#)
rem stops mouse from going upside down
if camAngX# > 80 and camAngX# < 180 then camAngX# = 80
if camAngX# > 180 and camAngX# < 310 then camAngX# = 310
ROTATE OBJECT dummyCam, camAngX#, camAngY#, object angle z(dummyCam)
camPosX# = object position x(dummyCam)
camPosY# = object position y(dummyCam)
camPosZ# = object position z(dummyCam)
camAngX# = object angle x(dummyCam)
camAngY# = object angle y(dummyCam)
camAngZ# = object angle z(dummyCam)
POSITION CAMERA 0, camPosX#, camPosY#, camPosZ#
ROTATE CAMERA 0, camAngX#, camAngY#, object angle z(dummyCam)
RETURN