Hallo again !!...as you know...you can make a object movements with the comand
MOVE OBJECT or positioning the object in coordinates x y z and we can put names to this coordinates ..right?
then ..it is the same to say:
first comand line-----if upkey() then move object 1,1
second comand line----if upkey() then z=z+1:position object 1,0,0,z
here is the example !!
autocam off:hide mouse:
sync on
make object box 1000,300,1,300:color object 1000,rgb(0,200,0)
make object sphere 1,5:color object 1,rgb(255,0,0)
make object sphere 2,5:color object 2,rgb(255,255,0)
position object 1000,0,-5,0
position camera -50,50,-50
point camera 0,0,0
do
if upkey() then move object 1,0.2
if downkey() then move object 1,-0.2
if upkey() then z#=z#+0.2
if downkey()then z#=z#-0.2
position object 2,10,0,z#
sync
loop
Knowing that !! you can use both comands (MOVE or POSITION) in order to udjust the position of your object(bike, car, spoon ,whatever)..
Now have a look how the objects update their position when collision with a ramp
autocam off:hide mouse:
sync on
make object box 1000,300,1,300:color object 1000,rgb(0,200,0)
make object sphere 1,5:color object 1,rgb(255,0,0)
make object sphere 2,5:color object 2,rgb(255,255,0)
set object collision to boxes 1
set object collision to boxes 2
ramp=3
make object box ramp,30,120,2
position object ramp,5,-5,30
xrotate object ramp,70
position object 1000,0,-5,0
position camera -50,50,-50
point camera 0,0,0
do
rem MOVE OBJECT comands-----------------------
rem ------------------------------------------
if upkey() then move object 1,0.2
if downkey() then move object 1,-0.2
rem POSITION OBJECT comands -------------------
rem -------------------------------------------
if upkey() then z#=z#+0.2
if downkey()then z#=z#-0.2
position object 2,10,y#,z#
rem COLLISION conditions------------------------
rem --------------------------------------------
if object collision(1,0)>0 then move object up 1,1 else move object down 1,1
if object collision(2,0)>0 then y#=y#+1 else y#=y#-1
position object 2,10,y#,z#
sync
loop
And now,just for fun , have a look to this code
autocam off:hide mouse:
sync on
make object box 1000,300,1,300:color object 1000,rgb(0,200,0)
make object sphere 1,5:color object 1,rgb(255,0,0)
make object sphere 2,5:color object 2,rgb(255,255,0)
set object collision to boxes 1
set object collision to boxes 2
ramp=3
second_ramp=4
make object box ramp,30,120,2
position object ramp,5,-5,30
xrotate object ramp,70
make object box second_ramp,80,1,20
position object second_ramp,20,0,-10
color object second_ramp,rgb(100,200,50)
position object 1000,0,-5,0
position camera -50,50,-50
point camera 0,0,0
do
rem MOVE OBJECT comands-----------------------
rem ------------------------------------------
if upkey() then move object 1,0.2
if downkey() then move object 1,-0.2
rem POSITION OBJECT comands -------------------
rem -------------------------------------------
if upkey() then z#=z#+0.2
if downkey()then z#=z#-0.2
position object 2,10,y#,z#
rem COLLISION conditions------------------------
rem --------------------------------------------
if object collision(1,0)>0 then move object up 1,1 else move object down 1,1
if object collision(2,0)>0 then y#=y#+1 else y#=y#-1
position object 2,10,y#,z#
ramp_turning#=wrapvalue(ramp_turning#+0.1)
zrotate object second_ramp,-ramp_turning#
sync
loop
Greetings
oh my god