If you have optimizations to add please post!
Problem: Your trying to move a sprite around and need it to not hit walls.
You have a regular 8x8 sized character. The walls are of any thickness.
So your first step after building a map is to set up a loop. Use something like repeat geykey(#) if the user presses that key the loop ends. Now choose the keys that will move the sprite, keep in mind going diagonal with this will look sloppy.
:prgmMAPSRC
:repeat getkey(15)
After you pick your keys for movement set up a loop for each key.Now pick the name of your subroutine. Put that in following the sub put the result. In the no deduct a point or life ect.
:If geykey(#)
:Sub(X,Y,W)
:If W=1
:L- -
:else
:X- - \or y- - or + +
:End
:End
The subroutine is dependent on the location of your sprite and a "hotspot" your going to use r1 as x and r2 as y. r3 is w.
:Lbl Sub
:pxl-test(r1+#, r2+#)-> r3
:Return
Now the last part to this is to close off the whole thing with an end and after the end a return.
:End
:Return
TADA! Its not that bad. In fact I have use it with 4 hotspots and a a multidriectional character, this code is less then 500 bytes.