You have to save the values first (they are floats, btw), move the object and then test for the collision. If it collides, you simply move it back to the original position.
sync on
sync rate 60
make camera 1
backdrop on
color backdrop RGB(255,0,0)
make object cube 1,20
position object 1,0,0,0
color object 1,RGB(0,50,255)
make object collision box 1, - 10,-10,-10,10,10,10,0
make object box 2,100,1,100
position object 2,0,-1,0
make object box 3,100,1,100
position object 3,-50,-100,0
color object 3,RGB(50,50,50)
make object cube 4,20
make object collision box 4, - 10,-10,-10,10,10,10,0
position object 4,50,0,0
color object 4,RGB(150,2,75)
do
prevx# = object position x(1) : posx# = prevx#
prevy# = object position y(1) : posy# = prevy#
prevz# = object position z(1) : posz# = prevz#
if upkey() = 1
posz# = posz# + 1
endif
if downkey() = 1
posz# = posz# - 1
endif
if rightkey() = 1
posx# = posx# + 1
endif
if leftkey() = 1
posx# = posx# - 1
endif
if object collision(1,2) or object collision(1,3)
else
posy# = posy# - 2
endif
position object 1,posx#,posy#,posz#
if object collision(1,4)
position object 1,prevx#,prevy#,prevz#
endif
position camera 1,object position x(1),object position y(1)+100,object position z(1)
point camera 1,object position x(1),object position y(1),object position z(1)
sync
loop