Hello i am working on a Car Game that let`s you select a car then style it with difrent type of parts Then Start on a Matrix LandScape but i don`t Know how to get the car moving after the matrix i havent created the matrix code yett but Here is the cod i have founded on this forum that might work for me
here is the code for matrix tilting
set display mode 800,600,32
sync on
autocam off
hide mouse
backdrop on
color backdrop 0
Rem Matrix
make matrix 1,5000,5000,50,50
Randomize Matrix 1,150
update matrix 1
Rem Objects
make object box 1,4,2,8
color object 1, RGB(255,0,0)
make object cube 6,1
glue object to limb 1,6,0
x#=100.0: z#=100.0
a#=get ground height(1,dx#,dz#)+1.0
Do
rem Control player with arrow keys
if upkey()=1 then x#=newxvalue(x#,a#,7): z#=newzvalue(z#,a#,7)
if leftkey()=1 then a#=wrapvalue(a#-5.0)
if rightkey()=1 then a#=wrapvalue(a#+5.0)
dx#=curvevalue(x#,dx#, 15.0)
dz#=curvevalue(z#,dz#, 15.0)
da#=curveangle(a#, da#, 10.0)
dec y#,4.0
if y# < get ground height(1,dx#,dz#)+1.0
y#=get ground height(1,dx#,dz#)+1.0
endif
Set Camera To Follow dx#,y#,dz#,Object Angle Y(6),20,y#+15,5,0
point camera dx#,y#+5,dz#
Gosub Calculate_Tilt
position object 6,dx#,y#,dz#
yrotate object 6,da#
rotate object 1,wrapvalue(length#),0,wrapvalue(width#)
if dx#>5000 or dx#<0 or dz#>5000 or dz#<0
dx#=500:dz#=500
x#=500:z#=500
endif
sync
Loop
End
Calculate_Tilt:
rem find the ground height at each corner of the Cube
temp_angle#=curveangle(a#, da#-20, 10.0)
front_left_x#=newxvalue(dx#,wrapvalue(temp_angle#),7.5)
front_left_z#=newzvalue(dz#,wrapvalue(temp_angle#),7.5)
front_left_height#=get ground height(1,front_left_x#,front_left_z#)
temp_angle#=curveangle(a#, da#+20, 10.0)
front_right_x#=newxvalue(dx#,wrapvalue(temp_angle#),7.5)
front_right_z#=newzvalue(dz#,wrapvalue(temp_angle#),7.5)
front_right_height#=get ground height(1,front_right_x#,front_right_z#)
temp_angle#=curveangle(a#, da#+20, 10.0)+180
rear_left_x#=newxvalue(dx#,wrapvalue(temp_angle#),7.5)
rear_left_z#=newzvalue(dz#,wrapvalue(temp_angle#),7.5)
rear_left_height#=get ground height(1,rear_left_x#,rear_left_z#)
temp_angle#=curveangle(a#, da#-20, 10.0)+180
rear_right_x#=newxvalue(dx#,wrapvalue(temp_angle#),7.5)
rear_right_z#=newzvalue(dz#,wrapvalue(temp_angle#),7.5)
rear_right_height#=get ground height(1,rear_right_x#,rear_right_z#)
rem calculate the amount to angle-tilt snowboard
length#=((rear_left_height#-front_left_height#)+(rear_right_height#-front_right_height#))/0.6
width#=((front_right_height#-front_left_height#)+(rear_right_height#-rear_left_height#))/0.2
Return
and here is the code for car movement
rem speed for car
spd# = 0
spd_max# = 10
spd_acc# = 0.50
car=1
Rem Main Loop
Do
Set Cursor 0,0
Print \"XPos#:\",XPos#
Print \"YPos#:\",YPos#
Print \"ZPos#:\",ZPos#
print \"speed: \",spd#
Position Listener XPos#,YPos#,ZPos#
move object car,spd#
if upkey()=1
if spd# < spd_max#
inc spd#,(spd_acc#*1)
endif
endif
if upkey()=0
if downkey()=0
if spd# > 0
dec spd#,(spd_acc#/5.5)
endif
if spd# <= 0
spd# = 0
endif
endif
endif
rem rotate car based on speed but make sure the rotation has a limit
cy# = object angle y(car)
if leftkey()=1
if spd#=1
Yrotate object car,Wrapvalue(cY#-spd#)
endif
endif
if spd#>1 and leftkey()=1 then Yrotate object car,Wrapvalue(cY#-2)
if rightkey()=1
if spd#=1
Yrotate object car,Wrapvalue(cY#+spd#)
endif
endif
if spd#>1 and rightkey()=1 then Yrotate object car,Wrapvalue(cY#+2)
If Downkey()=1 Then Move Object 1,-2
IF DownKey()=1 and LeftKey()=1 Then Yrotate object car,Wrapvalue(cY#+2)
IF DownKey()=1 and RightKey()=1 Then Yrotate object car,Wrapvalue(cY#-2)
Rem han Brace by SpaceKey
if spacekey()=1
dec spd#,(spd_acc#*5)
if spd# <=0 then spd#=0
endif
XPos#=Object Position X(1)
YPos#=Object Position Y(1)
ZPos#=Object Position Z(1)
Rem The sliding collision
If Object Collision(1,0)>0
Dec XPos#,Get Object Collision X()
Dec YPos#,Get Object Collision Y()
Dec ZPos#,Get Object Collision Z()
Endif
Position Object 1,XPos#,YPos#,ZPos#
Angle#=Object Angle y(1)
CamDist#=50.0 : CamHeight#=YPos#+20.0 : Camsmooth#=3.5
Set Camera To Follow XPos#,YPos#,ZPos#,Angle#,CamDist#,CamHeight#,CamSmooth#,0
Sync
Loop
but i don`t know how to get them work to gether i have tried but i havent gotten it worked so if some one getting it to work so plees poast and i will give credit`s
ps.
the car is Object 1 that need to folow the matrix tilt angel and with the same car movement code plees help am stuck
**StigDesign** cheap 3D Modell Pack`s at www.stigdesign.piczo.com (for Home&Comersial use)soon other aplication`s