This looked like a nice demo and I looked at the source code. (Confession: I know very little about PICO-8 coding). As I understand it the particles are added to the ptcls array but are never removed from it. If run for long enough (and more particles added) surely the ptcls array will continue to get larger and this will eventually run out of memory ?
Wouldn't the solution be to remove the particles when they reach a boundary of the screen?
in the update particle function, you would check if particle is now out of bounds, then remove it from the particles table.
changing a table while you’re iterating over it would cause problems in a
for i=1,#particles loop, but not in a
for particle in all(particles) loop. I’m not sure about foreach.
[Please log in to post a comment]