Here is that code fixed for DBC:
` ================================`
` Dark Basic Classic Vector Demo `
` ================================`
` This shows how vectors can be used to make smooth jumping really easily `
` Warning, this was coded in DBPro as this is all i have nowerdays,
` so please state on the forums if anything is not working.
`Setup`
Cls
Sync on
sync rate 60
Autocam off
`Make Landscape`
make matrix 1,1000,1000,20,20
randomize matrix 1,7
Load image "Grass.bmp",1
prepare matrix texture 1,1,1,1
`Position camera`
position camera -60,60,-60
point camera 50,20,50
`Make Character`
make object cube 1,20
position object 1,50,0,50
yrotate object 1,230
` Setup Vector System `
#include "VectorSystem.dba"
` Here sets up the vectors needed in the project `
Dim Vector2#(10,2)
Dim Vector3#(10,3)
`Setup a vector for the world Gravity `
SetVector3(1,0.0,-0.2,0.0)
`Setup a vector for the charcters speed `
SetVector3(2,0.0,0.0,0.0)
Do
Character()
Set_cam_to_follow_object(1,90.0,40.0,1)
Sync
Loop
Function Character()
` Store cubes starting positions `
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
ang#=object angle y(1)
`Rotating`
if leftkey()=1 then yrotate object 1,wrapvalue(ang#-1)
if Rightkey()=1 then yrotate object 1,wrapvalue(ang#+1)
`Give him gravity`
Addvector3(2,2,1)
`If up or down key is pressed add speed in set direction`
If upkey()=1
SetVector3X(2,XVector3(2)+newxvalue(0,ang#,0.2))
SetVector3Z(2,ZVector3(2)+newzvalue(0,ang#,0.2))
endif
If Downkey()=1
SetVector3X(2,XVector3(2)+newxvalue(0,ang#,-0.2))
SetVector3Z(2,ZVector3(2)+newzvalue(0,ang#,-0.2))
endif
`This adds some friction to the crazy sliding`
SetVector3X(2,XVector3(2)*0.95)
SetVector3Z(2,ZVector3(2)*0.95)
`If spacekey is pressed set his y speed to 5
if spacekey()=1 and (y#<=get ground height(1,x#,z#)) then setvector3(2,0.0,5.0,0.0)
`Position the object
nx#=object position x(1)+xvector3(2)
ny#=object position y(1)+yvector3(2)
nz#=object position z(1)+zvector3(2)
Position object 1,nx#,ny#,nz#
`If character is lower than the matrix then place him on it and set the vecticle speed to 0
If ny#<get ground height(1,nx#,nz#) then position object 1,nx#,get ground height(1,nx#,nz#),nz# : SetVector3Y(2,0.0)
Endfunction
function Set_cam_to_follow_object(obnum,distance#,height#,pointv)
x#=object position x(obnum)
y#=object position y(obnum)
z#=object position z(obnum)
ya#=object angle y(obnum)
x#=newxvalue(x#,(ya#+180),distance#)
z#=newzvalue(z#,(ya#+180),distance#)
y#=y#+height#
position camera x#,y#,z#
if pointv=1
point camera object position x(obnum),object position y(obnum),object position z(obnum)
else
point camera object position x(obnum),y#,object position z(obnum)
endif
Endfunction

"Lets migrate like bricks" - Me