You can replace all your ifs with jumps
If List L[I] = 0 :Then
Locate I, L, "▫"
IfEnd
0 = List L[I ⇒ Locate I, L, "▫"
and instead of using Lists, you can use a Matrix
[[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2][2, 3, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2][2, 2, 2, 2, 0, 2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2][2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2][2, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2][2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]] → Mat A
Mat A[Y, X] -> T
or maybe use strings
Strings have the added benefit of being very fast
"■■■■■■■■■■■■■■■■■■■■■○▫▫▫▫■▫▫▫▫▫▫▫▫▫▫▫▫■■■■■▫■■▫■▫▫▫▫▫▫▫▫▫▫■■▫▫▫▫■▫▫■▫■■■■■■■■■■■▫▫▫▫▫▫■■▫▫▫▫▫▫▫▫▫●■■■■■■■■■■■■■■■■■■■■■" -> Str1
For 1 -> Y To 6
Locate 1, Y, StrMid(Str1, 21Y-20, 21
Next
Exp(StrMid(Str1, 21Y+X-21, 1)) -> T
You don't actually need to check for ≠ 0
If List Y[X] != 0 :Then
If List Y[X :Then
If checking for both 0 and 1, can just check if lower than 2
Just make sure it cant equal -1
List Y[X] = 0 Or List Y[X] = 1 ⇒ Locate X, Y, " "
2 < List Y[X ⇒ Locate X, Y, " "
Instead of copy pasting code for all 4 movement directions
you can just save the current players position temporary
Move them, check if they are allowed to move, if so use the old position to clear the space behind them and draw the new position on the screen |