Once again I have copied somebodies code to see how it works so I can get the feel of game programming with DBPro. Well, theres a few command that don't work in DBP.. But when I take them out, it screws the hole game.
`Test Engine for GTA 1+2 style, By Van-B
`Arrow keys to move
`Mouse up/down to zoom
`Spacekey to enter/leave car
`
`Note - really small scale - the whole level is only 128x128 world units
` Set up 3D display properties
sync on : sync rate 0
set camera range 3,1000
`Load textures and car image
load image "Car.bmp",1
load image "Ground.bmp",2
load image "Building.bmp",3
load image "Bloke.bmp",4
`Setup player objects
`Make flat square (1x2), and texture it; this is our car
Make object plain 1,1,2
Texture object 1,1
`Make flat square (.5x.5), and texture it; this is our little man
Make object plain 2,0.5,0.5
Texture object 2,4
`Set the image to transparent, black is see through
set object 1,1,0,1,1
set object 2,1,0,1,1
`Rotate it so it lies flat on the ground
rotate object 1,90,180,0
fix object pivot 1
rotate object 2,90,180,0
fix object pivot 2
`Buildings
make object cube 3,8
texture object 3,3
`Matrix Stuff
Make matrix 1,128,128,64,64
prepare matrix texture 1,2,4,4
`Matrix collision, just an array identical to the matrix tile values
dim matrixdata(64,64)
`This is a simple matrix map, just the image numbers on a 64x64 grid, obviously you'd use a map editor

dim matrixmap$(64)
matrixmap$(00)="0000000000000000000000000000000000000000000000000000000000000000"
matrixmap$(01)="0000000000000000000000000000000000000000000000000000000000000000"
matrixmap$(02)="00000B000B000000B000B000000B00B0000000B000B00B000000B0000B00B000"
matrixmap$(03)="0000000000000000000000000000001111100000000000000000000000000000"
matrixmap$(04)="0000000000000000000000000000001222210000000000000000000000000000"
matrixmap$(05)="0000011111111111111111111111111222211111111111111111111111100B00"
matrixmap$(06)="0000012222222222222222222222222222222222222222222222222222100000"
matrixmap$(07)="0000012222222222222222222222222222222222222222222222222222100000"
matrixmap$(08)="0000012222222222222222222222222222222222222222222222222222100000"
matrixmap$(09)="0000012221111111111111111111111111111111111111111111111222100B00"
matrixmap$(10)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(11)="00000122210B0000000000000000000000000000000000000000001222100000"
matrixmap$(12)="0000012221000000000000000000000000000000000000000000001222100B00"
matrixmap$(13)="0000012221111111111111111111111100000000000000000000001222100000"
matrixmap$(14)="0000012221222222222222222222222100000000000000000000001222100B00"
matrixmap$(15)="0000012222222222222222222222222100B00000000000000000001222100000"
matrixmap$(16)="0000012222222222222222111222222100000000000000000000001222100000"
matrixmap$(17)="0000012221111111111111101222222100B00000000000000000001222100000"
matrixmap$(18)="0000012222222222222222111222222100B00000000000000000001222100B00"
matrixmap$(19)="0000012222222222222222222222222100B0000000000000000B001222100000"
matrixmap$(20)="0000012221222222222222222222222100000000000000000000001222100000"
matrixmap$(21)="0000012221111111111111111111111100000000000000000000001222100B00"
matrixmap$(22)="000001222100000000000000000000000000000000000000000B001222100000"
matrixmap$(23)="0000012221000000000000000000000000000000000000000000001222100B00"
matrixmap$(24)="000001222100B000B000B00B0000B00000000000000000000000001222100000"
matrixmap$(25)="000001222100000000000000000000000000000000000000000B001222100B00"
matrixmap$(26)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(27)="000001222100B000000000000000000000000000000000000000001222100000"
matrixmap$(28)="000001222100000000000000000000000000000000000000000B001222100B00"
matrixmap$(29)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(30)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(31)="000001222100B000000000000000000000000000000000000000001222100B00"
matrixmap$(32)="000001222100000000000000000000000000000000000000000B001222100000"
matrixmap$(33)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(34)="000001222100000000000000B000000000000000000000000000001222100000"
matrixmap$(35)="000001222100B000000000000000000000000000000000000000001222100B00"
matrixmap$(36)="000001222100000000000000000000000000000000000000000B001222100000"
matrixmap$(37)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(38)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(39)="00000122210000B00B0000000000000000000000000000000000001222100B00"
matrixmap$(40)="000001222100000000000000000000000000000000000000000B001222100000"
matrixmap$(41)="00000122210000000B0000000000000000000000000000000000001222100000"
matrixmap$(42)="00000122210000B00BB00000000000000000000000000000000B001222100B00"
matrixmap$(43)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(44)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(45)="000001222100B00000000000000000000000000000000000000B001222100000"
matrixmap$(46)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(47)="0000012221000000000000000000000000000000000000000000001222100B00"
matrixmap$(48)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(49)="000001222100000000000000000000000000000000000000000B001222100000"
matrixmap$(50)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(51)="000001222100B0000B000000B00B00000B0000000B00000000B0001222100000"
matrixmap$(52)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(53)="0000012221000000000000000000000000000000000000000000001222100000"
matrixmap$(54)="0000012221111111111111111111111111111111111111111111111222100000"
matrixmap$(55)="0000012222222222222222222222222222222222222222222222222222100000"
matrixmap$(56)="0000012222222222222222222222222222222222222222222222222222100000"
matrixmap$(57)="0000012222222222222222222222222222222222222222222222222222100000"
matrixmap$(58)="0000011111111111111111111111111111111111111111111111111111100000"
matrixmap$(59)="0000000000000000000000000000000000000000000000000000000000000000"
matrixmap$(60)="0000000000000000000000000000000000000000000000000000000000000000"
matrixmap$(61)="00000B000B000000B000000B000B00B0000B0B00000B000000B0000000B00000"
matrixmap$(62)="0000000000000000000000000000000000000000000000000000000000000000"
matrixmap$(63)="0000000000000000000000000000000000000000000000000000000000000000"
for x=0 to 63
for z=0 to 63
matrixdata(x,z)=1
next z
next x
for z=0 to 63
for x=0 to 63
map$=mid$(matrixmap$(z),x)
`Place a building?
if map$="B"
`Position, scale, and copy the building object into static objects
scale#=50+rnd(100)
position object 3,x*2,(8*(scale#/100))/2,z*2
scale object 3,100,100+scale#,100
make static object 3
else
tileno=val(map$)+1
endif
`If the tile is a building, then make the ground tile number 4, so we can collide with it

if map$="B"
`Buildings are 4x4 matrix grids big
for zz=-2 to 1
for xx=-2 to 1
bx=x+xx
bz=z+zz
`Only set the matrix tile to 4 if it's on the matrix
if bx>0 and bz>0 and bx-0.1 then dec spd#,0.02
else
if spd#>0 then dec spd#,0.01
if spd#-0.01 then spd#=0
endif
endif
else
`On foot
spd#=0
if upkey()=1 then spd#=0.08
if downkey()=1 then spd#=-0.08
endif
`Calculate new positions
npx#=newxvalue(px#,pangy#,spd#) : npz#=newzvalue(pz#,pangy#,spd#)
`Worlds worst collision detection, really just to give you a start
colx=npx#/2
colz=npz#/2
`If your at the edge, then you can't move
if colx>0 and colz>0 and colx4 then px#=npx# : pz#=npz# else npx#=px# : npz#=pz# : spd#=0
`If your in the car, then set locations to player
if playmode=1
cpx#=px#
cpz#=pz#
endif
`Get in/out of your car
if spacekey()=1
spd#=0
while spacekey()=1 : endwhile
if playmode=1
playmode=0
px#=newxvalue(cpx#,pangy#+90,1)
pz#=newzvalue(cpz#,pangy#+90,1)
show object 2
else
if px#>(cpx#-2.0) and px#(cpz#-2.0) and pz#
~Morph
Owner of
MultiCode.NET and
Multi2k.NET.
Nothing is something, and something is then nothing. Life is an illusion.