rem Setup global stuff
set display mode 640,480,32
hide mouse
autocam off
randomize timer()
rem Make terrain
make matrix 1,1000,1000,30,30
rem Make player
make object box 1,5,5,5
color object 1,rgb(0,255,0)
make object collision box 1,-2.5,-2.5,-2.5,2.5,2.5,2.5,0
position object 1,rnd(1000),2.5,rnd(1000)
yrotate object 1,rnd(360)
rem Make police
for p=2 to 4
make object box p,5,5,5
color object p,rgb(255,0,0)
make object collision box p,-2.5,-2.5,-2.5,2.5,2.5,2.5,0
position object p,rnd(1000),2.5,rnd(1000)
yrotate object p,rnd(360)
next p
rem Variables
type Particle
Life as integer
X as float
Y as float
Z as float
endtype
dim Particle(21) as Particle
Acceleration#=0.0
Friction#=0.005
rem Exhaust fumes
for p=10 to 20
make object plain p,3,3
rotate limb p,0,0,0,rnd(360)
disable object zwrite p
Particle(p).Life=((p-10)*10)
next p
rem Manual synchronisation
sync on
sync rate 0
rem Start the main loop
do
rem Control player
if upkey()=1
Acceleration#=Acceleration#+0.005
else
Acceleration#=Acceleration#-Friction#
endif
if downkey()=1
Acceleration#=Acceleration#-0.005
endif
if Acceleration#>1.0
Acceleration#=1.0
endif
if Acceleration#<0.0
Acceleration#=0.0
endif
if rightkey()=1 and Acceleration#>0.0
yrotate object 1,curveangle(object angle y(1)+5,object angle y(1),Acceleration#*10)
endif
if leftkey()=1 and Acceleration#>0.0
yrotate object 1,curveangle(object angle y(1)-5,object angle y(1),Acceleration#*10)
endif
move object 1,Acceleration#
rem Exhaust fumes
for p=10 to 20
if Particle(p).Life=0
Particle(p).Life=100
position object p,newxvalue(object position x(1),object angle y(1),-2.5),object position y(1),newzvalue(object position z(1),object angle y(1),-2.5)
else
dec Particle(p).Life,1
position object p,object position x(p),object position y(p)+0.1,object position z(p)
rotate limb p,0,0,0,limb angle z(p,0)+0.5
endif
point object p,camera position x(),camera position y(),camera position z()
next p
rem Police
for p=2 to 4
TempAng#=object angle y(p)
point object p,object position x(1),object position y(p),object position z(1)
yrotate object p,curveangle(object angle y(p),TempAng#,50)
move object p,0.9
Tempx#=object position x(p)
Tempy#=object position y(p)
Tempz#=object position z(p)
if object collision(p,0)>o
dec Tempx#,get object collision x()
dec Tempz#,get object collision z()
endif
position object p,Tempx#,Tempy#,Tempz#
next p
rem Control camera
position camera object position x(1),object position y(1),object position z(1)
rotate camera 30,object angle y(1),0
move camera -20
rem Update the screen
sync
rem End the main loop
loop
Hope that helps.
[Edit]
Damn! Just noticed the 2D part!
[/Edit]