Limit number of particles on screen?

Get help using Construct 2

Post » Mon Mar 18, 2013 7:32 am

To avoid slowdown and high CPU usage, how to limit them?
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Mon Mar 18, 2013 4:41 pm

Use the expression ParticleCount - from the manual:

ParticleCount
The number of particles the Particles object currently has. This is important to ensure you are not creating too many particles and slowing the game down; see the Optimisation section above. Note that due to the way Construct 2 expressions work, if you have multiple Particle object instances, this will only return the particle count for one of the instances - use a For Each loop to count multiple instance's total particle count.

Set conditions for creating particles. For example, if the particle count is too high, either don't create the new particle, or delete older ones.

This may result in some undesirable graphical effects though. It is probably best practice to plan ahead so you won't be able to get into a situation where you have too many particles on screen (by limiting the number of particles fired, setting the duration lower, or being creative with animated sprites.)
Mistakes were made.
B
37
S
17
G
67
Posts: 1,041
Reputation: 38,211


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 22 guests