Umm...is this what you're talking about? I don't really know what other box you're talking about, since there are 2 that don't rotate..
sync on
sync rate 60
make object box 3,10,10,10
make object box 4,10,20,10
make object box 5,10,20,10
set object collision on 4
set object collision on 5
position camera 0,0,50,-150
do
if leftkey() = 1
move object left 3,1
endif
if rightkey () = 1
move object right 3,1
endif
if object collision (4,5)
rotate object 4,0,((object position x(4) - object position x (5)) * 10) ,0
endif
if object collision (5,4)
rotate object 5,0,((object position x(5) - object position x (4)) * 10 ),0
endif
position object 4,object position x (3),20,0
sync
loop