Talk:Wizard/@comment-70.245.30.50-20130217232154

Here's how I did collision detection in Attack of the Gravi.

You want to have it where it detects it before you move, like this:

@RIGHT

newx=x+1

gosub @horcollision

if move==0 then return

x=newx

return

@horcollision

if map (newx,y)==1 then move=0:return else move=1

return

For left, just copy @RIGHT, except with newx being x-1.

For up/down, just copy @horcollision, change it to map (x,newy), and you're done.