I have Updated the Code a lot and have fixed a bunch of functions, and Thanks to TDK for the code to make the orbits happen correctly, I noticed that on my work machine (dell 2.4) that the frame rate is a lot less than my home machine (dell 2.4) I can only assume the difference is due to the graphics card as one has ATI and the other an intel graphics card, so keep in mind if you are getting slower frame rates then maybe you need to update your graphics card to handle 3-d better. this code gets 70 to 80 FPS on my Home Machine and only about 40 to 50 on my work machine. (since I dont program for a living I dont think I will get this machine upgraded just for this.)
at any rate the scene is still very cool and I have made a lot of chages to the keys for the interface as well, added swithing cameras by mouseclick, and added more objects and a good rotation bit, and more.....you'l have to look and see.......
I will add a screen shot to this post so you get an idea of what this code looks like running.
o first the code:
rem Updated date 9-21-05
rem created by Jon Ericson from code snips taken from
rem theGamecreators.com
rem this code my be used as long as all authors are given
rem the credit they deserve for their code.
rem Initialise
sync on : sync rate 0
if check display mode(1024,768,32)=1 then set display mode 1024,768,32
rem Create board data
ink rgb(255,255,0),0
`text 10,10,"F/s: "+str$(screen fps())+" "
global t1=1
tOb = 1
`Global curpos=-150
dim board(4,4)
seq=1 : for y=0 to 4 : for x=0 to 4 : board(x,y)=seq : inc seq : next x : next y
board(4,4)=0
rem Loading screen
make object sphere 1,70
make object sphere 2,20
make object sphere 3,15
make object sphere 4,10
make object sphere 5,40
position object 5,-200,-100,200
position object 4,100,-100,100
position object 3,-30,-46,-40
position object 2,40,0,40
set object light 1,1
set object light 2,3
`ghost object on 1,1
texture object 1,2
position camera 0,500,50,2000
make mesh from object 1,2
add limb 1,1,1
offset limb 1,1,30,30,30
rotate limb 1,1,-10,0,0
`make mesh from object 2,2
add limb 1,2,1
offset limb 1,2,-60,-90,-60
add limb 1,3,1
offset limb 1,3,-79,-20,-30
glue object to limb 3,1,3
set camera rotation xyz
set object collision on 1
set object collision on 2
set object collision on 3
set object collision on 4
set object collision on 5
Radius#=150.0: AngleInc=1: Rem Speed of rotation
XDist#=Radius#: XDistInc=0-AngleInc
ZDist#=Radius#: ZDistInc=AngleInc
rem Create scene
create bitmap 1,screen width(),screen height()
create bitmap 2,screen width(),screen height()
create bitmap 3,screen width(),screen height()
create bitmap 4,screen width(),screen height()
create bitmap 5,screen width(),screen height()
create bitmap 6,screen width(),screen height()
create bitmap 7,screen width(),screen height()
rem this controls the camera action.
autocam off
rem Create plasma
load image "media\plasma\plasma.bmp",1
load image "media\plasma\clouds2.jpg",2
load image "media\plasma\cool_effect_plasma.bmp",3
load image "media\plasma\old_plasma.bmp",4
load image "media\plasma\odd_plasma.bmp",5
load image "media\plasma\a1.bmp",6
load image "media\plasma\clouds3.jpg",7
for pl=1 to 10
make object plain 100+pl,256,256
`make object sphere 100+pl,12,52,52
position object 100+pl,rnd(30)-15,rnd(30)-15,150
texture object 100+pl,1
set object light 100+pl,0
ghost object on 100+pl,2
next pl
rem Load sounds
` load sound "media\sounds\wind1.wav",1
` load sound "media\sounds\wind2.wav",2
` loop sound 1 : loop sound 2
rem Setup light
make light 1
set point light 0,0,500,0
set point light 1,0,500,0
` set spot light 0,1,100
` set spot light 1,1,100
color light 0,rgb(255,255,155)
color light 1,rgb(255,255,155)
position light 0,0,200,0
position light 1,0,200,0
set ambient light 0
rem Start backdrop banding
band=1 : r=0 : g=0 : b=0
rem Shuffle board start position
xx=(screen width()-1)/1.0 : yy=(screen height()-1)/1.0
rem Render loop
gosub _return
do
if scancode()=25
for p=1 to 4
delete particles p
next p
gosub _return
endif
rem Main visual screen
set current bitmap 0
cls 0 : print screen fps()
`text 10,10,"F/s: "+str$(screen fps())+" "
rem Draw all tiles
for y=0 to 3
for x=0 to 3
sx=x*0 : sy=y*0 : seq=board(x,y)
if seq>0
placey=(seq-1)/4 : placex=(seq-1)-(placey*4)
copy bitmap 1,(placex*xx),(placey*yy),(placex*xx)+xx,(placey*yy)+yy, 0,(x*xx)+sx,(y*yy)+sy,(x*xx)+sx+xx,(y*yy)+sy+yy
endif
next x
next y
rem Render hidden 3D scene
set current bitmap 1
rem Shift plasma plains
p#=wrapvalue(p#+0.1)
randomize 3
for pl=1 to 10
a#=wrapvalue(p#+(pl*45))
x#=rnd(50)-25 : y#=rnd(50)-25
if pl<=5 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,50-(pl*6)
if pl>=6 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,pl-160
next pl
rem Shift plasma plains
p#=wrapvalue(p#+0.2)
randomize 7
for pl=1 to 10
a#=wrapvalue(p#+(pl*55))
x#=rnd(50)-20 : y#=rnd(50)-20
if pl<=5 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,50-(pl*2)
if pl>=6 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,pl-260
next pl
rem Shift plasma plains
p#=wrapvalue(p#+0.3)
randomize 3
for pl=1 to 10
a#=wrapvalue(p#+(pl*65))
x#=rnd(150)-115 : y#=rnd(150)-115
if pl<=5 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,50-(pl*6)
if pl>=6 then position object 100+pl,x#+cos(a#)*50,y#+sin(a#)*50,pl-60
next pl
rem Slowly change the backdrop colour
if band=1 then r=r+t1
if band=1 and r>255 then r=255 : band=2
if band=2 then g=g+t1 : r=r-t1
if band=2 and g>255 then g=255 : r=0 : band=3
if band=3 then b=b+t1 : g=g-t1
if band=3 and b>255 then b=255 : g=0 : band=4
if band=4 then r=r+t1 : b=b-t1
if band=4 and r>255 then r=255 : b=0 : band=2
color backdrop rgb(r,g,b)
rem Update screen
` set camera to follow object
`camera
`set current camera 0
cx=camera position x(0)
cz=camera position z(0)
ox=object position x(1)
oz=object position z(1)
if cx<ox+75 and cx>ox-75 and cz<oz+75 and cz>oz-75
else
set camera to follow 0,object position x(tOb),object position y(tOb),object position z(tOb),360,<200,150,150,0
endif
point camera 0,object position x(tOb),object position y(tOb),object position z(tOb)
` set camera to follow 0,object position x(1),object position y(1),object position z(1),360,<20,150,150,0
` point camera 0,object position x(1),object position y(1),object position z(1)
`other commands
texture object 1,7
texture object 4,7
texture object 5,7
texture object 2,2
texture object 3,6
rotate object 1,0,2,0
rotate object 2,-.1,-.3,-.03
fix object pivot 2
fix object pivot 1
position light 0,0,500,0
position light 1,100,500,0
`roll object left 1,1
`roll object right 2,1
`if mouseclick()
`endif
rem test area
X# = WrapValue(z# + AngleInc)
Z# = WrapValue(x# + AngleInc)
If X#>359-AngleInc or Z#>359-AngleInc
Inc XDist#,XDistInc
If XDist#<=0-Radius#
XDist#=0-Radius#: XDistInc=AngleInc
YDist#=0.0: YDistInc=0-AngleInc
Endif
If XDist#>Radius#
XDist#=Radius#: XDistInc=0-AngleInc
YDist#=0.0: YDistInc=0-AngleInc
Endif
Endif
Position Object 3, newxvalue(0,X#,XDist#),newyvalue(0,Y#,YDist#),newzvalue(0,Z#,ZDist#)
Position Object 2, newxvalue(0,X#,XDist#),newyvalue(0,Y#,YDist#),newzvalue(0,Z#,ZDist#)
Position Object 4, newxvalue(0,X#-3,XDist#-30),newyvalue(0,Y#-3,YDist#-30),newzvalue(0,Z#-3,ZDist#-30)
Position Object 5, newxvalue(0,X#+90,XDist#+90),newyvalue(0,Y#+90,YDist#+90),newzvalue(0,Z#+90,ZDist#+90)
rem end test area
`check for keypress
gosub _checkkeys
` write info on screen for debugging
ink rgb(b,r,g),0
text 10,10,"F/s: "+str$(screen fps())+" "
text 10,20,"object 1 positionX="+str$(object position x(1))
text 10,30,"object 1 positiony="+str$(object position y(1))
text 10,40,"object 1 positionz="+str$(object position z(1))
text 10,50,"object 2 positionX="+str$(object position x(2))
text 10,60,"object 2 positiony="+str$(object position y(2))
text 10,70,"object 2 positionz="+str$(object position z(2))
text 10,80,"Camera PositionX="+str$(camera position x(0))
text 10,90,"Camera PositionY="+str$(camera position y(0))
text 10,100,"Camera PositionZ="+str$(camera position z(0))
loop
` Particle Sub-section
_return:
for p=1 to 4
make particles p,0,15,15
color particles p,r,g,b
rotate particles p,rnd(100),rnd(1000),rnd(10000)
set particle emissions p,rnd(5)
set particle floor p,rnd(9)
set particle gravity p,2
next p
return
`check keys Sub-section
_checkkeys:
la = light position x(0)
lb = light position y(0)
lc = light position z(0)
ld = light position x(1)
le = light position y(1)
lf = light position z(1)
sync
if upkey()=1 then pitch camera up 0,2
if downkey()=1 then pitch camera down 0,2
if leftkey()=1 then TURN camera LEFT 0,2
if rightkey()=1 then TURN camera right 0,2
if spacekey()=1 then Position camera 0,100,100,100
`if CONTROLKEY()=1 then set camera to follow 0,object position x(2),object position y(2),object position z(2),360,700,150,100,0
if scancode()=1
tOb = 1
`position light 0,0,500,0
endif
if scancode()=2
tOb = 2
`position light 0,0,500,0
`set object fog 1,1
endif
if scancode()=3
tOb = 3
`position light 0,0,500,0
endif
if scancode()=4
tOb = 4
`position light 0,0,500,0
endif
if scancode()=5
tOb = 5
`position light 0,0,500,0
endif
if scancode()=6
tOb = 1
`position light 0,0,500,0
endif
if scancode()=7
texture object 1,6
position light 0,0,500,0
endif
if scancode()=8
texture object 1,7
position light 0,0,500,0
endif
if scancode()=9
texture object 1,8
position light 0,0,500,0
endif
if scancode()=10
roll object left 1,3.14
pitch object up 1,.01
endif
if scancode()=11
set camera to follow 0,-1000,-500,5,1000,100,100,0
endif
if scancode()=12 then tOb = 2
if scancode()=13 then tOb = 3
`if scancode()=14 then
`if scancode()=15 then
if scancode()=16
position light 0,la+2,lb,lc
position light 1,-la+2,le,lf
endif
if scancode()=17
position light 0,la-2,lb,lc
position light 1,-la-2,le,lf
endif
if scancode()=18 then set camera to follow 0,object position x(2),object position y(2),object position z(2),360,700,150,100,0
`if scancode()=19 then
`if scancode()=20 then
if scancode()=21
texture object 101,4
texture object 102,4
texture object 103,4
texture object 104,4
texture object 105,4
texture object 106,4
texture object 107,4
texture object 108,4
texture object 109,4
texture object 110,4
endif
if scancode()=22
texture object 101,1
texture object 102,1
texture object 103,1
texture object 104,1
texture object 105,1
texture object 106,1
texture object 107,1
texture object 108,1
texture object 109,1
texture object 110,1
endif
if scancode()=23
texture object 101,5
texture object 102,5
texture object 103,5
texture object 104,5
texture object 105,5
texture object 106,5
texture object 107,5
texture object 108,5
texture object 109,5
texture object 110,5
endif
if scancode()=24 then position camera 0,500,50,1000
`if scancode()=25 then
`if scancode()=26 then
`if scancode()=27 then
`if scancode()=28 then
`if scancode()=29 then
if scancode()=30
position light 0,la,lb+2,lc
position light 1,ld,le+2,lf
endif
if scancode()=31
position light 0,la,lb-2,lc
position light 1,ld,le-2,lf
endif
remstart
if scancode()=32
set spot light 0,+2,+2
set spot light 1,+2,+2
endif
if scancode()=33
set spot light 0,-2,-2
set spot light 1,-2,-2
endif
remend
`if scancode()=34 then
`if scancode()=35 then
if scancode()=36 then roll camera left 0,1
if scancode()=37 then roll camera right 0,1
`if scancode()=38 then
`if scancode()=39 then
`if scancode()=40 then
`if scancode()=41 then
`if scancode()=42 then
`if scancode()=43 then
if scancode()=44
position light 0,la,lb,lc+2
position light 1,ld,le,-lc+2*2
endif
if scancode()=45
position light 0,la,lb,lc-2
position light 1,ld,le,-lc-2*2
endif
if scancode()=46
position light 0,0,100,0
position light 1,0,100,0
endif
if scancode()=47
color light 0,255,0,100
color light 1,100,0,255
endif
if scancode()=48 then rotate limb 1,1,0,0,3
`if scancode()=49 then
`if scancode()=50 then
`if scancode()=51 then
`if scancode()=52 then
`if scancode()=53 then
`if scancode()=54 then
`if scancode()=55 then
`if scancode()=56 then
`if scancode()=57 then
`if scancode()=58 then
`if scancode()=59 then
`if scancode()=60 then
`if scancode()=61 then
return
you can use one of the downloads above to get the media directory, and you can change the media to your liking as you want( I keep experimentiing with different planet textures and such )
have fun and don't forget give credit to TDK, UNDERLORD, j0hn6oo, for their Code snips used to make this all happen, and deffinately don't forget ME, the ANGRY KREYON, the one who put all this great stuff together and made it work, I AM GREAT!!!! *LOL*