A demo of what I think you are after, when you've worked out how its working then put those bits into your program
Rem ***** Main Source File *****
` set up the program
sync on
sync rate 60
phy start
autocam off
position camera -20,20,-25
point camera 0,10,0
make light 1
set directional light 1, -5,-5,5
` make the floor
make object box 1,40,1,40
phy make rigid body static box 1
` create dynamic box and make this one kinematic
make object box 4,5,5,5
position object 4,10,6,0
phy make rigid body dynamic box 4
phy set rigid body kinematic 4, 1
` create second dynamic box and make this one kinematic
make object box 5,5,5,5
position object 5,-10,6,0
phy make rigid body dynamic box 5
phy set rigid body kinematic 5, 1
` colour all of our objects
for i = 4 to 6
if object exist ( i )
color object i, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular i, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power i, 255
set object ambient i,0
endif
next i
` some variables we use in the main loop
x# = 0
x2#=9
move = 0
` main program loop
do
` adjust the position of the kinematic object on the x axis
if move = 0
x# = x# - 0.1
x2#=x2#+ 0.1
if x# < -2
move = 1
endif
endif
if move = 1
x# = x# + 0.1
x2#=x2#-0.1
if x# > 2
move = 0
endif
endif
` control the position of the kinematic object
phy set rigid body kinematic position 4, x#, 6, 0
phy set rigid body kinematic position 5, x2#, 6, 0
` update the simulation and screen
phy update
sync
loop
Dark Physics makes any hot drink go cold.