A couple questions about Particle2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lincolnpepper

In my new game i am using particles to represent stars in the background that quickly move downward to represent you moving forward in space, similarly (in fact, pretty much the same) to galaga. I have it working but there are a couple things that i want. Firstly, is there a way to terminate the particle when it reaches the end of the screen? My particles have varying speeds at random so i can’t really just set an exact time. And secondly, is there a way to spawn particles immediately? I want the particles to spawn at the top of the screen and go down, but this means that upon starting the game it takes time for the particles to actually show up on the whole screen, so is there a way to randomly make a few first? Thanks for your help!

:bust_in_silhouette: Reply From: markopolo

Is there a way to terminate the particle when it reaches the end of the screen?

There is not (as far as I know) a way in Godot 3 to designate an area so that all particles that enter it are deleted. Is there a specific reason you want to remove them as soon as they’re offscreen? You might try setting an absurdly long lifespan and seeing if there’s any adverse effects.

secondly, is there a way to spawn particles immediately?

Yes! You’re looking for the preprocess parameter in the Time section of the Particles2D Node. I think that’ll do what you’re looking for.

Thank you! I just want to terminate them then because it would save some unnecessary particles, but it doesn’t make a big difference anyway

lincolnpepper | 2018-04-05 21:47