That's easy! No functions are required. However, I did write a
tutorial on them if you need it.
Okay, now for your question! All you need to do is store where you were before you moved in 3 variables. Then, when you collide with something just position the object at those 3 variables! Here's an example:
sync on
sync rate 60
autocam off
rem MAke a floor
Make MAtrix 1,10000,10000,40,40
rem Make a player sphere
MAke object sphere 1,10
position object 1,5000,0,5000
rem MAke a cube that we will hit
Make object cube 2,40
position object 2,5050,0,5000
SPEED=3
do
rem Store our positions before movement in 3 variables
OldX#=OBject position x(1)
OldY#=OBject position y(1)
OldZ#=OBject position z(1)
rem Movement control here (It can be whatever kind of movement you want)
Position object 1,OBject position x(1)+SPEED*(Rightkey()-LEftkey()),0,OBject position z(1)+SPEED*(Upkey()-Downkey())
rem Now, after the movement, let's test to see if we hit the cube.
if Object collision(1,2)
position object 1,Oldx#,Oldy#,Oldz#
endif
rem Position the camera
position camera OBject position x(1),OBject position y(1)+20,Object position z(1)-100
sync
loop
And for collision, the (if) OBJECT COLLISION command works better. It's just like (if) OBJECT HIT but it is better for collision. It will check to see if the objects are colliding more than once.
Ummm...