I've been writing a little testing 3D program to get myself familiar with the DBP language, and I'm stuck trying to get this little cube that you can move around to stay above the matrix when I move it.
This is the code I have for the matrix:
make matrix 1, 300, 300, 10, 10
position matrix 1, 0, -5, 0
randomize matrix 1, 25
prepare matrix texture 1, 1, 1, 1
set matrix texture 1, 1, 1
update matrix 1
And for the cube:
make object cube 1,5
position object 1, 125, 0, 125
And later in the main do loop for the cube's movement:
do
if rightkey()=1 then y=wrapvalue(y+2)
if leftkey()=1 then y=wrapvalue(y-2)
yrotate object 1, y
if upkey()=1 then move object 1,1
if downkey()=1 then move object 1,-1
set camera to follow object position x(1), object position y(1), object position z(1), object angle y(1), 10, 5, 7, 0
cx=object position x(1)
cz=object position z(1)
cy=get ground height(1, cx, cz)+10
position object 1, cx, cy, cz
sync
loop
It will rotate fine. The trouble comes trying to move it. It moves forward the first time you press the up key, (although it's a little jerky in its motion for some reason) but when you release the up key, and then press it again, the cube won't move. What am I doing wrong? Any help would be appreciated.