here is the code:
set display mode 800,600,16
#include "load.dba"
MagicLoad("track/test/testlevel",1,1,1)
set camera range 1,100000000
position matrix 1,0,0,0
update matrix 1
make object box 10,20,5,20
ghost object on 10
position object 10,50,100,50
sync on
do
if upkey() then x#=newxvalue(x#,yang#,3):z#=newzvalue(z#,yang#,3)
if downkey() then x#=newxvalue(x#,yang#,-3):z#=newzvalue(z#,yang#,-3)
position object 10,x#,get ground height(1,x#,z#)+10,z#
yang#=rotatecar(10)
sync
loop
function rotatecar(id)
x#=object position x(id)
z#=object position z(id)
yang#=object angle y(id)
set camera to follow x#,100,z#,yang#,200,get ground height(1,x#,z#)+160,5,5
point camera x#,get ground height(1,x#,z#),z#
`vooraan
posx#=newxvalue(x#,yang#,10)
posz#=newzvalue(z#,yang#,10)
posy1#=get ground height(1,posx#,posz#)
`achter
posx#=newxvalue(x#,yang#,-10)
posz#=newzvalue(z#,yang#,-10)
posy2#=get ground height(1,posx#,posz#)
`rechts
posx#=newxvalue(x#,yang#+90,10)
posz#=newzvalue(z#,yang#+90,10)
posy3#=get ground height(1,posx#,posz#)
`links
posx#=newxvalue(x#,yang#-90,10)
posz#=newzvalue(z#,yang#-90,10)
posy4#=get ground height(1,posx#,posz#)
difr#=posy3#-posy4#
set cursor 0,0
print "difr l/r = ";difr#
xang#=atanfull(20,difr#)
difr#=posy1#-posy2#
print "difr f/b = ";difr#
zang#=atanfull(20,difr#)
yang#=wrapvalue(yang#+mousemovex())
yrotate object 10,yang#
xrotate object id,xang#
zrotate object id,zang#
endfunction yang#
i want to make a racing game, object nr 10 is the car and it must rotates just as the matrix is, but it doesn't. could somebody help me?
thanks in advance
sorry for my bad english
if I = 1 then I = 1 else I = 0