Log In  

draw particle

Cart #zozuhropa-0 | 2022-01-13 | Code ▽ | Embed ▽ | No License

P#104991 2022-01-13 13:00 ( Edited 2022-01-19 03:14)

:: merwok

wait, this is not a voxatron tutorial :-D

P#105352 2022-01-19 01:33

my mistake, thank you.

P#105355 2022-01-19 03:15
:: phil

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?

P#105361 2022-01-19 11:51
:: merwok

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.

P#105369 2022-01-19 16:14

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2022-08-15 07:03:12 | 0.008s | Q:19