making smoke particles, multiple instantianting

Im making this script which objective is to make smoke start in the middle and slowly enter trough doors and spaces. you guys can feel free to use it.

I got it almost right, except the part that i don’t want to put an emmiter where there is already one. I decided to check if there were any emmiters in the same position as the old ones, but even if they are in the same position, the condition simply isn’t met. EVER.

so, some help please? i think it may be on the remakeArrays method, also, i noted i only effectively blocked a new object from placing when they are the thisRing array, so maybe there as well?

So, any suggestions? this looks very much like a pathfinding algorithm, so if any of you got any experience in that kind of stuff maybe?

thanks guys!

226359–8159–$smokecreator_115.js (3.12 KB)

Probably the best thing to use here is a flood fill algorithm. There are similarities between this and the A* algorithm, but there is no actual path to be recovered here, as such.

Thanks! I’ll dive a bit into the the algorithm and try it

guess i was reinventing the wheel eh? That’s what i get for not having studied computer science