You should definitly use arrays and 'for'-loop, your code is really hard to read.
Use functions to cut your code into multiple simple operations.
Also use comments to explain which part of the code do what.
And beware, TIC implement a more formal LUA than PICO-8. That means that number are double precision floating point number and not 32bit fixed point like in PICO-8. It means that if you increament by a real number, let's say 0.34 every frame and you start from x=0 and you want to check when x==1:
x = 0 while «condition» do if x==1 then «do a thing» end x = x + 0.34 end ----execution: x==0 x==0.34 x==0.68 x==1.02 --x==1 is never checked
if you want to use check points with floating point numbers, use intervals instead of discrete values:
x = 0 while «condition» do if 0.9<x and x<1.1 then «do a thing» end x = x + 0.34 end ----execution: x==0 x==0.34 x==0.68 x==1.02 --> 0.9<1.02<1.1 --> condition is checked !