___ ___ / /\ / /\ ___ / /::| / /::\ / /\ / /:|:| / /:/\:\ / /::\ / /:/|:|__ / /::\ \:\ / /:/\:\ /__/:/_|::::\ /__/:/\:\_\:\ / /::\ \:\ \__\/ /--/:/ \__\/ \:\/:/ /__/:/\:\_\:\ / /:/ \__\::/ \__\/ \:\/:/ / /:/ / /:/ \ \::/ /__/:/ /__/:/ \__\/ \__\/ \__\/ ___ ___ ___ ___ ___ ___ / /\ / /\ / /\ / /\ / /\ / /\ / /:/ / /::\ / /::\ / /::\ / /::\ / /::\ / /:/ / /:/\:\ / /:/\:\ / /:/\:\ / /:/\:\ / /:/\:\ / /:/ / /:/ \:\ / /::\ \:\ / /:/ \:\ / /::\ \:\ / /::\ \:\ /__/:/ /__/:/ \__\:\ /__/:/\:\_\:\ /__/:/ \__\:| /__/:/\:\ \:\ /__/:/\:\_\:\ \ \:\ \ \:\ / /:/ \__\/ \:\/:/ \ \:\ / /:| \ \:\ \:\_\/ \__\/-|::\/:/ \ \:\ \ \:\ /:/ \__\::/ \ \:\ /:/ \ \:\ \:\ | |:|::/ \ \:\ \ \:\/:/ / /:/ \ \:\/:/ \ \:\_\/ | |:|\/ \ \:\ \ \::/ /__/:/ \__\__/ \ \:\ |__|:| \__\/ \__\/ \__\/ \__\/ \__\|

This is a tutorial in progress on the creation of a map loader; also known as: Map Loader.

## Code Edit

Delvar O[A]→[J]:2→X:7→Y :Lbl 1 :ClrHome :For(A,1,8 :For(B,1,16 :If [J](A,B)=1:Output(A,B,1 :If [J](A,B)=2:Output(A,B,"C :End :End :Lbl 9 :Output(Y,X,"8 :getKey→Z :Y→G:X→H :If Z=0:Goto 9 :Output(G,H," " :If [J](Y,X)=1:Goto 9 :Y-(Z=25)+(Z=34)→Y :X+(Z=26)-(Z=24)→X :If [J](Y,X)=0:Goto 9 :If [J](Y,X)=2:Then :D+1→D :0→[J](Y,X) :End :If [J](Y,X)=3:Then :[B]→[J] :Output(Y,X,"8 :14→X:7→Y :Goto 1 :End :If [J](Y,X)=4:Then :[A]→[J] :Output(Y,X,"8 :14→X:2→Y :Goto 1 :End :If [J](Y,X)=5:Then :[C]→[J] :Output(Y,X,"8 :2→X:3→Y :Goto 1 :End :If [J](Y,X)=6:Then :[B]→[J] :Output(Y,X,"8 :15→X:3→Y :Goto 1 :End :Goto 9

[A] =

[[1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,1] [1,2,1,1,1,1,1,0,0,0,0,0,1,0,0,1] [1,0,1,1,1,1,1,0,0,0,0,0,1,0,0,1] [1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1] [1,0,0,0,1,1,1,1,0,0,0,0,1,1,0,1] [1,0,1,1,1,2,0,1,1,1,1,0,0,0,0,1] [1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1] [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]

[B] =

[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,1]]

[C] =

[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]

## Explanation Edit

:0→D:[A]→[J]:2→X:7→Y

Initialization

:Lbl 1 :ClrHome :For(A,1,8 :For(B,1,16 :If [J](A,B)=1:Output(A,B,1 :If [J](A,B)=2:Output(A,B,"C :End :End

This prints the map onto the screen one character at a time.

:Lbl 9 :Output(Y,X,"8

This prints the current location.

:getKey→Z

Gets a key and stores it in Z

:Y→G:X→H :If Z=0:Goto 9 :If [J](Y,X)=1:Goto 9

If the location does not change, go back to Lbl9 and try getting another key.

:Output(G,H," "

Clear the current location.

:Y-(Z=25)+(Z=34)→Y :X+(Z=26)-(Z=24)→X

Move left, right, up or down depending on which key was pressed.

:If [J](Y,X)=0:Goto 9

If the new location has an id of 0, nothing else happens. Get another key.

:If [J](Y,X)=2:Then :D+1→D :0→[J](Y,X) :End

If the new location has an id of 2, add a point and change that location's id to 0

:If [J](Y,X)=3:Then :[B]→[J] :Output(Y,X,"8 :14→X:7→Y :Goto 1 :End :If [J](Y,X)=4:Then :[A]→[J] :Output(Y,X,"8 :14→X:2→Y :Goto 1 :End :If [J](Y,X)=5:Then :[C]→[J] :Output(Y,X,"8 :2→X:3→Y :Goto 1 :End :If [J](Y,X)=6:Then :[B]→[J] :Output(Y,X,"8 :15→X:3→Y :Goto 1 :End

Change rooms. Set a new matrix as [J] and reload the map.

:Goto 9

If the key pressed did not do anyhting else, get another key.

## Credits and flaws Edit

- It is fairly slow to load each map... I do realise Lists would be faster, but it would complicate the entire process of movement and loading new rooms/maps...
- Movement is slow to respond...
- Any help/optimisations appreciated