right, this source is a basic downed version off my full game. Theres 3 vehicles (Cubes) and a cylinder which is a player character
the cylinder has a movement of 10 when you press the upkey i need some code based on this so when you go within a certain range of one of the cubes and press enter the camera is positioned behind that cube and that cube becomes the player object until enter is pressed again and you return playing as the cylinder leaving the cube where you pressed enter last. I also need it so the speed is changed depending on which 'vehicle' youre in. heres th source
Rem Make sphere
Rem Setup sync
Sync On
Sync Rate 30
Rem Make a slow van
Make object cube 1,100
scale object 1,100,100,150
Position object 1,Rnd(2000),0,Rnd(2000)
Set object collision to boxes 1
Rem Make a fast car
Make object cube 2,100
color object 2,rgb(0,0,250)
scale object 2,100,50,150
Position object 2,Rnd(1000),0,Rnd(2000)
Set object collision to boxes 2
Rem Make a small average speed car
Make object cube 3,100
color object 3,rgb(250,0,0)
scale object 3,100,50,150
Position object 3,Rnd(1000),0,Rnd(2000)
Set object collision to boxes 3
rem make land scape
Make object cube 4,100
color object 4,rgb(0,128,0)
scale object 4,10000,1,15000
Position object 4,Rnd(1000),0,Rnd(2000)
Set object collision to boxes 4
set object collision off 4
Rem Make person
Make object cylinder 10,50
scale object 10,50,100,50
Position object 10,-100,0,-100
Set object collision to spheres 10
Rem Main loop
Do
Rem Store Object angle Y in aY#
aY# = Object angle Y(10)
Rem Control input for camera
If Upkey()=1 then Move object 10,10
If Leftkey()=1 then Yrotate object 10,Wrapvalue(aY#-5)
If Rightkey()=1 then Yrotate object 10,Wrapvalue(aY#+5)
Rem Detect collision
If Object collision(10,0)>0 then position object 10,X#,0,Z#
Rem get player object position and store in X# and Z#
X# = Object position x(10)
Z# = Object position z(10)
Rem get new camera position and store in cZ# and cX#
cZ# = Newzvalue(Z#,aY#-180,100)
cX# = Newxvalue(X#,aY#-180,100)
Rem position camera
Position Camera cX#,75,cZ#
Rem point the camera at the player object
Point camera X#,25,Z#
Rem Refresh Screen
Sync
Loop