Oh.. ok.
Thanks!
Rem * Title : City test
Rem * Author : Nadav H
Rem * Date : 2005
hide mouse
rem Load map
load object "ct.x",1
SET OBJECT COLLISION TO polygons 1
rem made the player dummy
MAKE OBJECT SPHERE 2, 50
SET OBJECT COLLISION TO SPHERES 2
hide object 2
rem load texture
load image "ctmap.jpg", 1
texture object 1 ,1
rem restart map
rotate object 1, 270,0,0
position object 1, 0,-50, 0
POSITION OBJECT 2, 0,0,0
position camera 0,0,0
rem integers
Rotation#=0.0
RotationSpeed#=0.0
MaxRotationSpeed#=5.0
Acceleration#=0.25
Deceleration#=0.2
MaxSpeed#=30.0
MoveSpeed#=0.0
gravity#=6.0
tgravity#=gravity#
GAcceleration#=0.4
rem drive(0), park(1), stop(3)
dstat=0
sync rate 30
sync on
rem game loop
do
`old x,y,z
ox#=Object Position x(2)
oy#=Object Position y(2)
oz#=Object Position z(2)
rem speed control
if upkey()=1 then MoveSpeed#=MoveSpeed#+Acceleration#
if upkey()=0 then if dstat=0 then MoveSpeed#=MoveSpeed#-Deceleration#
if downkey()=1
MoveSpeed#=MoveSpeed#-Deceleration#
if dstat=0 then MoveSpeed#=MoveSpeed#-Acceleration#
endif
if downkey()=0 then if dstat=1 then MoveSpeed#=MoveSpeed#+Deceleration#
if MoveSpeed#>0 then dstat=0
if MoveSpeed#<0 then dstat=1
if dstat=0 then if MoveSpeed#>MaxSpeed# then MoveSpeed#=MaxSpeed#
if dstat=1 then if MoveSpeed#<-5.0 then MoveSpeed#=-5.0
if dstat=0 then if MoveSpeed#<0.00 then MoveSpeed#=0.00
if dstat=1 then if MoveSpeed#>0.00 then MoveSpeed#=0.00
if upkey()=0 and downkey()=0 and MoveSpeed#=0.00 then dstat=3
if upkey()=0 and downkey()=0 and dstat=3 then MoveSpeed#=0.00
rem rotation control
if leftkey()=1 then Rotation#=Rotation#-(MoveSpeed#/MaxSpeed#+0.2)*MaxRotationSpeed#
if rightkey()=1 then Rotation#=Rotation#+(MoveSpeed#/MaxSpeed#+0.2)*MaxRotationSpeed#
if Rotation#>360.0 then Rotation#=Rotation# - 360.0
if Rotation#<0 then Rotation#=Rotation# + 360.0
rem move and rotate
rotate object 2 ,0,Rotation#,0
move object 2,MoveSpeed#
rotate camera 0,Rotation#,0
position camera object position x(2),object position y(2),object position z(2)
`new x,y,z
nx#=Object Position x(2)
ny#=Object Position y(2)
nz#=Object Position z(2)
rem gravity
tgravity#=tgravity#+GAcceleration#
`ny#=ny#-tgravity#
position object 2, nx#,ny#,nz#
rem collision & gravity
tmpy#=ny#
remstart bad idea... :\
while (Object collision(2,0)<>0) and ny#-tmpy#<10
tgravity#=gravity#
ny#=ny#+0.1
position object 2, nx#,ny#,nz#
endwhile
remend
If Object collision(2,0)<>0
text 50, 30, "HIT!!!"
If Object collision(2,0)<>0
MoveSpeed#=MoveSpeed#/1.03
position object 2, nx#,oy#,oz#
If Object collision(2,0)<>0
MoveSpeed#=MoveSpeed#/1.03
position object 2, ox#,oy#,nz#
If Object collision(2,0)<>0
MoveSpeed#=0.0
position object 2, ox#,oy#,oz#
endif
endif
endif
endif
set text size 12
text 50, 10, "Speed: "+str$(MoveSpeed#)
text 50, 20, "FPS: "+str$(Screen FPS())
sync
loop
suspend for key
delete object 1
end
Btw, you can find the source with the madia files.