TGC Codebase Backup



Simple solar system model by Philip

22nd Sep 2003 13:13
Summary

This is a simple solar system model. Originally written by Arbitrage but amended and edited by Indi and Philip



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    rem care of arbitrages code in classic many moons ago (no pun intended)
rem edited and cleaned up by indi
rem further edited and fiddled with by Philip

sync on : sync rate 60 : randomize timer()
hide mouse

color backdrop rgb(0,0,0)


rem the default light that starts on is zero
color light 0, 255, 255, 224
set point light 0, 0, 0, 0


rem an internal yellow texture for the sun
ink rgb(255, 255, 000),1
box 0,0,32,32
get image 1,0,0,32,32
cls

rem the sun
make object sphere 1,5000
position object 1, 0, 0, 0
texture object 1, 1
SET OBJECT 1, 1, 0, 1, 1, 0, 0, 0
rem SET OBJ Object Number, Wire, Transparent, Cull, Filter, Light, Fog, Ambient

set light range 0, 100000


rem other planets and moons
make object sphere 2,1000
make object sphere 3,200


rem create stars image
for i = 1 to 50

     e = rnd(255)
     dot rnd(255),rnd(255),rgb(e,e,e)

next f

get image 2, 0, 0, 256, 256


rem create star sphere
make object sphere 4, 40000, 20, 20
position object 4, camera position x(0), camera position y(0), camera position z(0)
texture object 4, 2
scale object texture 4, 8, 8
set object 4, 1, 0, 0, 0, 0, 0, 0

for i = 2 to 3

     rem set object light i, 1
     rem set object ambient i, 1
     color object i,rgb(rnd(255),rnd(255),rnd(255))

next i


AngleY3#=120

set camera range  1,20000

Position camera 0, 10000, -15000

Point camera 0,0,0


disable escapekey

while escapekey() = 0

     if upkey() = 1 then pitch camera up 0, 1

     if downkey() = 1 then pitch camera down 0, 1

     if leftkey() = 1 then turn camera left 0, 1

     if rightkey() = 1 then turn camera right 0, 1

     if returnkey() = 1 then move camera 0, 200

     if controlkey() = 1 then move camera 0, -200

     AngleY1#= AngleY1#+0.01
     AngleY2#= AngleY2#+0.1

     x2#= NewXValue(0,AngleY1#,10000)
     z2#= NewZValue(0,AngleY1#,10000)
     x3#= NewXValue(x2#,AngleY2#,3000)
     z3#= NewZValue(z2#,AngleY2#,3000)

     Position object 2,x2#,0,z2#
     Position object 3,x3#,0,z3#

     for i = 1 to 3

          ink rgb(255, 255, 255), rgb(255, 255, 255)

          if i = 1 then string$ = "The Sun"
          if i = 2 then string$ = "Planet Indi"
          if i = 3 then string$ = "Lunch Hamper Moon"

          if object in screen(i) = 1

               center text object screen x(i), object screen y(i), string$

          endif

     next i

     position object 4, camera position x(0), camera position y(0), camera position z(0)

     sync

endwhile

for i = 1 to 3

if object exist(i)=1
delete object i
endif

if image exist(i)=1
delete image i
endif

next i
end