I've been going through some of the old dba files on my hard disk and found lots of stuff I did when I first started with DB.
I've got tons of the stuff - some useful, some not. Some of it might be of use to someone new to DB, so I'll post a few on here for you to have a play with.
All done with DB Classic (cos that's all there was back then), but most should still work OK with DBP - you'll just have to try.
Anyone who has any questions about any of the code, please feel free to post...
And remember, this stuff is from when I was new to DB, so no taking the mickey about my code! Lol.
This one is a simple never-ending scrolling matrix - you never reach the end! Just hold down the left mouse button.
Gosub Setup
Do
Gosub ReadMouse
sync
Ink RGB(255,255,255),0
Text 5,1,"Never Ending Matrix Example - By TDK_Man (March 2001)"
Loop
Setup:
Set Display Mode 800,600,16
Hide Mouse
Sync On
Set Ambient light 50
Randomize Timer()
TilesX=25: TilesZ=25: Tilesize#=128.0: MatZPos#=0.0
Create Bitmap 1,Tilesize#,Tilesize#
Ink RGB(0,50,0),0
Box 1,1,Tilesize#-2,Tilesize#-2
For T=1 To 5000
M=Rnd(200)
Ink Rgb(0,M,0),0
Dot Rnd(Tilesize#),Rnd(Tilesize#)
Next T
Get Image 1,0,0,Tilesize#,Tilesize#
Delete Bitmap 1
MatWidth#=TilesX*Tilesize#: MatHeight#=TilesZ*Tilesize#
MatCentreX#=MatWidth#/2.0: MatCentreZ#=MatHeight#/2.0
Make Matrix 1,MatWidth#,MatHeight#,25,25
PREPARE MATRIX TEXTURE 1,1,1,1
Fog Distance 950
FOG COLOR RGB(0,0,100)
Fog On
For N1=0 to TilesZ
For N2=0 to TilesX
SET MATRIX HEIGHT 1, N2, N1, Rnd(100)
Next N2
Next N1
Update Matrix 1
Gosub Normalise
Set Camera Range 1.0, 1000.0
Position Camera MatCentreX#, 120.0, MatCentreZ#
Point Camera MatCentreX#, 0.0, MatHeight#
Return
ReadMouse:
CX#=CAMERA ANGLE X(): CY#=CAMERA ANGLE Y(): CZ#=CAMERA ANGLE Z()
CX#=Wrapvalue(CX# + mousemovey() )
CY#=Wrapvalue(CY# + mousemovex() )
Rotate Camera CX#,CY#,CZ#
If MouseClick()=1
If MatZPos#>(0-Tilesize#)
Dec MatZPos#,8
Else
MatZPos#=-8.0
SHIFT MATRIX Up 1
Endif
Position Matrix 1, 0.0, 0.0, MatZPos#
Gosub Normalise
Endif
Return
Normalise:
Rem By Lee Bamber From DB Example
For z=1 to TilesZ
For x=1 to TilesX
h8#=get matrix height(1,x,z-1)
h4#=get matrix height(1,x-1,z)
h#=get matrix height(1,x,z)
h2#=get matrix height(1,x,z)
x1#=(x-1)*25.0
y1#=h#
x2#=(x+0)*25.0
y2#=h4#
dx#=x2#-x1#
dy#=y2#-y1#
ax#=atanfull(dx#,dy#)
ax#=wrapvalue(90-ax#)
z1#=(z-1)*25.0
y1#=h2#
z2#=(z+0)*25.0
y2#=h8#
dz#=z2#-z1#
dy#=y2#-y1#
az#=atanfull(dz#,dy#)
az#=wrapvalue(90-az#)
nx#=sin(ax#)
ny#=cos(ax#)
nz#=sin(az#)
Set matrix normal 1,x,z,nx#,ny#,nz#
next x
next z
Update Matrix 1
Return
TDK_Man