I am now assuming that you have read Part 1 of this tutorial. If not, you can find it at http://petitcomputer.wikia.com/wiki/How_to_make_a_simple_collision_(part_1)
But for all of you who did...
Where we left off, we made it so you could build the backround. But actually, you built the collision detection in Part 1! We just have to do the collision detectors!
So. First, we'll make your character. First, we'll put the X and Y coords.
Then we start the loop.
This is for in case we have your character touch a background.
IF B AND 1 THEN Y=Y+1
IF B AND 2 THEN Y=Y-1
IF B AND 4 THEN X=X-1
IF B AND 8 THEN X=X+1
This is for movement. Now for the collision DETECTORS:
IF MAP(FLOOR(X+2)/8,FLOOR(Y/8)) THEN X=OLDX
IF MAP(FLOOR(X/8),FLOOR(Y+2)/8) THEN Y=OLDY
IF MAP(FLOOR(X-2)/8,FLOOR(Y/8)) THEN X=OLDX
IF MAP(FLOOR(X/8),FLOOR(Y-2)/8) THEN Y=OLDY
This will read all 4 sides of the character. And now, we draw your character.
GCIRCLE X,Y,2 (IF 2 DOESN'T WORK RIGHT, TRY 4)
Randomous- for his COLITEST, which really helped
Me- for making this tutorial
You- For reading