hey moonman
try this example, it's van B's array collision with sliding collision it's a bit hard to see though
`Sliding array collision example by Van-B
sync on
sync rate 60
`Just an array full of 1's and 0's
dim colmap(64,64)
`Random dots
for n=0 to 1000
x=rnd(63)
y=rnd(63)
colmap(x,y)=1
box (x*6),(y*6),(x*6)+7,(y*6)+7
next n
`Collision box around scene
for n=0 to 63
y=0 : x=n
colmap(x,y)=1
box (x*6),(y*6),(x*6)+7,(y*6)+7
y=63 : x=n
colmap(x,y)=1
box (x*6),(y*6),(x*6)+7,(y*6)+7
y=n : x=0
colmap(x,y)=1
box (x*6),(y*6),(x*6)+7,(y*6)+7
y=n : x=63
colmap(x,y)=1
box (x*6),(y*6),(x*6)+7,(y*6)+7
next n
get image 1,0,0,384,384
`Defaults
x1=40
y1=40
size=2
ink 255,0
do
`Set the old values before changing them
oldx1=x1
oldy1=y1
if upkey()=1 then dec y1,1
if downkey()=1 then inc y1,1
if leftkey()=1 then dec x1,1
if rightkey()=1 then inc x1,1
`*********************************************************************
`*********************************************************************
`Check the 4 corners of the box
if colmap(int((x1-size)/6.0), int((oldy1-size)/6.0))=1 then x1=oldx1
if colmap(int((oldx1-size)/6.0),int((y1-size)/6.0)) =1 then y1=oldy1
if colmap(int((x1-size)/6.0), int((oldy1+size)/6.0))=1 then x1=oldx1
if colmap(int((oldx1-size)/6.0),int((y1+size)/6.0)) =1 then y1=oldy1
if colmap(int((x1+size)/6.0), int((oldy1-size)/6.0))=1 then x1=oldx1
if colmap(int((oldx1+size)/6.0),int((y1-size)/6.0)) =1 then y1=oldy1
if colmap(int((x1+size)/6.0), int((oldy1+size)/6.0))=1 then x1=oldx1
if colmap(int((oldx1+size)/6.0),int((y1+size)/6.0)) =1 then y1=oldy1
`*********************************************************************
`*********************************************************************
`Paste the backdrop and the player box
paste image 1,0,0
box (x1-size)+1,(y1-size)+1,(x1+size)+1,(y1+size)+1
sync
loop
the bit of code marked in ******* is how the collision code works
basically it gets the coordinates of the 4 corners of the box then performs an equation to turn each x ordinate and y ordinate of the corners into which x tile and y tile in the array they are on. Then if they're on a tile they shouldn't be on the box gets moved back to where it was before the collision happened
sorry if i haven't explained this well enough - just send a post of what you dont undestand
anyways hope this helps
pizzaman