i altered Yogz code a slight bit so i could run it in DBPro (and have a free-roam camera). you will still have to download everything else from his site (media etc.) and paste this code in.
***THIS IS NOT MY CODE, 99.999% OF IT BELONGS TO YOGZ AND IT IS AN OLDER VERSION THAN HE CURRENTLY HAS FOR DOWNLOAD.***
SET DISPLAY MODE 800,600,16
Randomize Timer()
Hide Mouse
Sync Rate 50
Sync On
Backdrop On
Color Backdrop rgb(50,50,150)
enable static occlusion
Sync
set camera range 1,3000
set text font "Arial"
ink rgb(0,255,0),0
set text size 12
` Create Tank
autocam off
gosub create_tank
` Create fish
gosub populate_fish
` Plants
gosub populate_plants
` Camera
position camera 0,100,-200
do
` gosub fish_move_manual
for tm=1 to noFish
if timer()-memory(tm)>5000
m(tm)=rnd(1)
memory(tm)=timer()+rnd(3000)
endif
move_fish(tm,m(tm),sel)
if tm=sel then text object screen x(tm),object screen y(tm),name$(tm)
next tm
text 10,10,"fps - " + str$(screen fps())
` Bubbles
for tb=50 to 60
if object position y(tb)>0 then show object tb
bubbles(tb)
next tb
` Camera
` point camera object position x(sel), object position y(sel), object position z(sel)
` Select Fish
if keystate(15)=1 then nsel=sel+1
if keystate(15)=0 and nsel<>sel then sel=nsel
if sel>noFish then sel=1: nsel=sel
` Make water wobble
randomize matrix 1,1:update matrix 1
yrotate camera wrapvalue(camera angle y()+mousemovex())
sync
xrotate camera wrapvalue(camera angle x()+mousemovey())
if upkey()=1 then move camera 5
if downkey()=1 then move camera -5
loop
fish_move_manual:
if downkey()=1 then pitch object up 1,5
if upkey()=1 then pitch object down 1,5
if leftkey()=1 then roll object left 1,5
if rightkey()=1 then roll object right 1,5
if spacekey()=1 then size#=size#+0.25:scale object 1,size#*1000,size#*1000,size#*1000
if inkey$()="=" then s#=s#+0.025
if inkey$()="-" then s#=s#-0.025
move object 1,s#
return
create_tank:
` Water
dim x4mat#(4,3)
x4mat#(1,1)=-200
x4mat#(1,2)=195
x4mat#(1,3)=-100
make matrix 1,400,200,10,10
position matrix 1,x4mat#(1,1),x4mat#(1,2),x4mat#(1,3)
load bitmap "water.bmp",1
get image 1,0,0,25,25
delete bitmap 1
prepare matrix texture 1,1,2,2
ghost matrix on 1
randomize matrix 1,1
update matrix 1
undim x4mat#(1,3)
` Glass
back$="back1.bmp"
grit$="gblue.bmp"
make object box 111,2,200,200 : position object 111,-200,100,0 : color object 111,rgb(155,155,255):ghost object on 111
make object box 112,10,200,200 : position object 112, 200,100,0 : color object 112,rgb(155,155,255):ghost object on 112
make object box 113,400,200,2 : position object 113,0,100,-100 : color object 113,rgb(155,155,255):ghost object on 113
make object box 114,400,200,2 : position object 114,0,100, 100 : load image back$,1:texture object 114,1:delete image 1
make object box 115,400,2,200 : position object 115, 0, 200, 0 : color object 115,rgb(155,40,20):ghost object on 115
make object box 116,400,2,200 : position object 116, 0, 0, 0 : load image grit$,1:texture object 116,1:scale object texture 116,4,4:delete image 1
` Make the wall and floor objects into static objects (for auto-camera collision)
for t=111 to 116
objx#=object position x(t)
objy#=object position y(t)
objz#=object position z(t)
objsx#=object size x(t)/2.0
objsy#=object size y(t)/2.0
objsz#=object size z(t)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#
next t
hide object 113
hide object 115
`Bubbles
for t=50 to 60
make object sphere t,2
color object t,rgb(100,100,100)
ghost object on t
position object t,0+(rnd(10)-rnd(10)),0-rnd(100)+50*2,50
xrotate object t,270
next t
return
populate_plants:
load object path$+"aqua04.x",120:position object 120,0,0,0
load object path$+"aqua05.x",121:position object 121,50,0,50
load object path$+"aqua06.x",122:position object 122,-50,0,50
load object path$+"aqua08.x",123:position object 123,-50,0,-50
load object path$+"aqua09.x",124:position object 124,50,0,-50
load object path$+"aqua10.x",125:position object 125,25,0,25
load object path$+"aqua11.x",126:position object 126,-25,0,-25
load object path$+"aqua12.x",127:position object 127,-25,0,25
for t=120 to 127
color object t,rgb(0,rnd(99)+51,0)
scale object t,100,100,100
next t
return
populate_fish:
noFish=20
path$="Models/"
fish$="NeonTetra0.x"
Dim memory(noFish)
Dim m(noFish)
Dim size#(noFish)
Dim cax#(noFish)
Dim cay#(noFish)
Dim caz#(noFish)
Dim s#(noFish)
Dim name$(noFish)
for t=1 to noFish
memory(fish)=timer()+rnd(15000)
m(fish)=rnd(1)
size#(t)=rnd(3)+1
load object path$+fish$,t
position object t,rnd(160)-rnd(160)+40,rnd(120)+40,rnd(60)-rnd(60)+40
yrotate object t,90
fix object pivot t
scale object t,size#(t)*1000,size#(t)*1000,size#(t)*1000
objx#=object position x(t)
objy#=object position y(t)
objz#=object position z(t)
objsx#=object size x(t)/2.0
objsy#=object size y(t)/2.0
objsz#=object size z(t)/2.0
make object collision box t,objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#,0
next t
sel=1:nsel=sel
name$(1)="Gumpy"
name$(2)="Pepsi"
name$(3)="Moby"
name$(4)="Juju"
name$(5)="Ploppy"
name$(6)="Frodo"
name$(7)="Bob"
name$(8)="Martini"
name$(9)="Duracel"
name$(10)="Sam"
name$(11)="Tim"
name$(12)="Fred"
name$(13)="Loo"
name$(14)="Tizer"
name$(15)="Lilt"
name$(16)="Tango"
name$(17)="Bongo"
name$(18)="Metz"
name$(19)="Beamish"
name$(20)="Fizz"
return
function move_fish(fish,opt,sel)
anglex#=object angle x(fish)
angley#=object angle y(fish)
anglez#=object angle z(fish)
` X Angle (up and down)
if object position y(fish)<40
if anglex#<270 then anglex#=wrapvalue(anglex#-20)
endif
if object position y(fish)>39 and object position y(1)<161
if opt=0 then anglex#=wrapvalue(anglex#-0.2)
if opt=1 then anglex#=wrapvalue(anglex#+0.2)
endif
if object position y(fish)>160
if anglex#>270 then anglex#=wrapvalue(anglex#+20)
endif
` Y Angle (left and right)
if object position z(fish)>50 or object position z(fish)<0-50
if opt=0 then angley#=wrapvalue(angley#+20)
if opt=1 then angley#=wrapvalue(angley#-20)
endif
if object position x(fish)>150 or object position x(fish)<0-150
if opt=0 then angley#=wrapvalue(angley#+20)
if opt=1 then angley#=wrapvalue(angley#-20)
endif
` Z Angle (rolling)
mz=rnd(1)
if mz=0 then anglez#=wrapvalue(anglez#-3)
if mz=1 then anglez#=wrapvalue(anglez#+3)
if anglez#>40 and anglez#<45 then anglez#=wrapvalue(anglez#-3)
if anglez#>270 and anglez#<265 then anglez#=wrapvalue(anglez#+3)
ms=rnd(6)+1
if ms=2 then s#(fish)=s#(fish)+0.25
if ms=3 then s#(fish)=s#(fish)+0.25
if s#(fish)>1 then s#(fish)=2
cax#(fish)=curveangle(anglex#, cax#(fish), 5.0)
cay#(fish)=curveangle(angley#, cay#(fish), 5.0)
caz#(fish)=curveangle(anglez#, caz#(fish), 5.0)
` Store the object position
oldposx#=object position x(fish)
oldposy#=object position y(fish)
oldposz#=object position z(fish)
` Move object
rotate object fish,cax#(fish),cay#(fish),caz#(fish)
move object fish,s#(fish)
` Store position again
posx#=object position x(fish)
posz#=object position z(fish)
posy#=object position y(fish)
` Collision detection
position object fish,posx#,posy#,posz#
fs#=object size z(fish)/2.0
if get static collision hit(oldposx#-fs#,oldposy#-fs#,oldposz#-fs#,oldposx#+fs#,oldposy#+fs#,oldposz#+fs#,posx#-fs#,posy#-fs#,posz#-fs#,posx#+fs#,posy#+fs#,posz#+fs#)=1
dec posx#,get static collision x()
dec posy#,get static collision y()
dec posz#,get static collision z()
endif
` Update the object position
position object fish,posx#,posy#,posz#
rem Use camera tracker to follow selected object
if fish=sel
angle#=object angle y(sel)
camdist#=500.0 : camhigh#=posy#+10.0 : camfade#=30.5
rem set camera to follow posx#,posy#,posz#,angle#,camdist#,camhigh#,camfade#,1
endif
endfunction
function bubbles(bubble)
if object position y(bubble)<190
move object bubble,0.75
else
hide object bubble
position object bubble,0+(rnd(10)-rnd(10)),0-rnd(100)+50*2,50
endif
endfunction
Yogz, hope you don't mind me reposting your code. as for the models, i'll start cranking them out, textured and animated, and post them here as i progress.
"Creativity is knowing how to hide your sources" - Einstein