How to make a simple collision (part 1)

Okay. So first thing's first, this is SO NOT for beginners. It is at least for an intermediate programmer. But for all of you listening anyway, here we go.

So, first, we do what we usually do at the beginning of a program. ACLS:CLEAR Now we need to dim the map. DIM MAP(32,24) Simple, right? Now we put on the cool music. BGMPLAY 29 Okay! Now we restore where we want to read the data! RESTORE @MAP Good, good. Now the first FOR command. FOR J=0 TO 31 The J should equal the X map coordinate, minus one. Same with the I for command for Y. READ MAP$

FOR I=0 TO 23 Now... the hard part. MAP(I,J)=0

IF MID$(MAP,I,1)=="+" THEN MAP(I,J)=1

IF MID$(MAP,I,1)=="-" THEN MAP(I,J)=2

IF MAP(I,J)==1 THEN BGPUT 0,I,J,32,9,0,0

IF MAP(I,J)==2 THEN BGPUT 0,I,J,32,0,0,0 Now, the first command makes every map coordinate 0. The second and third command say "if the data reads '+' then that coordinate is stored as one." Same with the other one and 2. The last two commands state, "if the map coordinate is 1, it put a grass block down in the coordinate, and if it reads 2, it will put down a dead grass. But now we put down the map data.

@MAP DATA "

DATA "

DATA"

DATA"

DATA"

DATA"

DATA"

DATA"

DATA"

DATA"

DATA"

DATA"

DATA"++++++++++++++++-+++++++++++++++++--++++++++++++++++++++++-++++++++++++++++++++++++++++++++++++++

DATA"---++++++++++++-++++++++++++++++++---

DATA"---+++---+++++++---++

DATA"---

DATA"---

DATA"---

DATA"---

DATA"---

DATA"---

DATA"--- Now, this exceeds the limit of the dim command, so everything outside of the limit won't be printed.

Thanks for reading! I'll make a part 2 on this post soon on how to make the character move, and collide!