Ive been writing this code for the better part of the morning.. Well anyway. The problem that i have is that the cube at the bottom(btank){under enemy_ai} doesnt move at all.
Thats my main question. Could anyone tell me or point me in the right direction of getting my cube to tilt with the matrix so the edges dont dissapear?
1 more thing, can anyone thing of and efficient way to tilt and rotate a tank turret but keep it over/attatched the tank.
Note: The grass texture can be found in the darkbasic pro media folder. (also the tank model has been removed and relpaced with a cube)
Sync : sync rate 60
rem **************************************************************
gosub name_object_num
gosub load_objects
rem **************************************************************
Do
gosub player_move
gosub enemy_ai
sync : loop
rem **************************************************************
name_object_num:
rem images
grasstex = 1
rem models
atank = 1
btank = 2
rem matrixes
grasstestm=1
return
rem **************************************************************
load_objects:
rem load images and textures
`texture first
load image "grass_T.bmp",grasstex
`images second
rem load meshes
make object cube atank,4
make object cube btank,4
rem makes matrixes
`grass test matrix
make matrix grasstestm,5000,5000,50,50
randomize matrix grasstestm,50
prepare matrix texture grasstestm,grasstex,2,2
for x = x to rnd(49) +1
for z = z to rnd(49) +1
t = rnd(3)+1
set matrix tile grasstestm,x,z,t
next z
next x
rem positions starting objects
position camera 100,0,100
position object btank,0,0,100
return
rem **************************************************************
player_move:
set cursor 0,0
print screen fps()
print ptankX# ;" X value"
print ptankY# ;" Y value"
print ptankZ# ;" Z value"
print ptankangley# ;" Y angle value"
Rem Store Object angle
Rem Control input for camera
If Upkey()=1
ptankX# = Newxvalue(ptankX#,ptankAngleY#,5)
ptankZ# = Newzvalue(ptankZ#,ptankAngleY#,5)
If ptankX#>0 and ptankX#<5000 and ptankZ#>0 and ptankZ#<5000
Move object atank,10
Endif
Endif
If Leftkey()=1 then ptankangleY#= Wrapvalue(ptankAngleY#-5)
If Rightkey()=1 then ptankangleY#= Wrapvalue(ptankAngleY#+5)
ptankX# = ptankX#
ptankZ# = ptankz#
ptankY# = Get ground height(grasstestm,ptankX#,ptankZ#)
yrotate object atank , ptankangley#
position object atank,ptankX#,ptankY#+2,ptankZ#
Position Camera ptankX#-50,ptankY#+100,ptankZ#-50
point camera ptankX#,ptankY#,ptankz#
return
rem **************************************************************
enemy_ai:
if ctankX#<1 then ctankX# = ctankX# + 5
if ctankX#>500 then ctankX# = ctankX# -5
ctanky# = get ground height (grasstestm,ctankX#,100)
position object btank,ctankX#,ctankY#+2,0
return
quad 10k terrahert cpu| 9k^9k terrabyte(tb) hd|stolen military graphics card capable of rendering all of the pixar movies in 5 secs|999^9k tb of ram
15in monitor with 13in veiwable screen