Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I use a single particle system for each type of effect. So, one for a fire effect, one for a sparkle, one for an explosion, etc.</p> <p>I use a category to add [enable] and [disable] methods to the base Cocos2D particle systems which looks like this:</p> <p>ParticleEnhancement.h</p> <pre><code>#include "cocos2d.h" @interface CCParticleSystem (particleEnhancement) -(void)enable; -(void)disable; @end </code></pre> <p>ParticleEnhancement.m</p> <pre><code>#import "ParticleEnhancement.h" @implementation CCParticleSystem (particleEnhancement) -(void)enable { active = YES; elapsed = 0.0f; } -(void)disable { active = NO; } @end </code></pre> <p>Then when I want to trigger it I just set the position and call enable. The particle system will spawn a bunch of particles based on the initialization settings. The system can be triggered multiple times in different positions and previously generated particles will behave properly.</p> <p>The main thing to consider is that you will need a larger particle budget to account for multiple instances of a given effect using a single system.</p> <p>Also, this works for "triggered" effects, like an explosion but may not work so well for a long running effect like a smoke trail, I haven't really tested that.</p> <p>I like doing it this way because it means I have fewer particle systems to wrangle and I don't have to deal with setting up a pool of particle systems. The particle system itself does a good job of handling a pool of particles, no need to replicate that again on the system level.</p> <p>This technique is being used in my app <a href="http://tcgcounter" rel="nofollow noreferrer">TCG Counter</a> for all of the particle effects.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload