O'Reilly logo

Mastering Android Game Development by Raul Portales

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Emitters

The other way to use particle systems is to configure them as emitters. This means that there is a ratio of particles per second that your system emits while it is active.

Calculating the right pool size is quite easy. It is just a formula based on the particle's time to live and the number of particles per second you want. For example, using 20 particles per second with 500 milliseconds time to live, you only need a pool of 10 particles, since they are returned to the pool as they die.

It is important to remember that a ParticleSystem working as an emitter needs to be added and removed from the GameEngine, since the onUpdate method is required to check for the spawning of more particles. The onUpdate method of the ParticleSystem looks ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required