Lektorelli Posted May 20, 2016 Share Posted May 20, 2016 I'm obviously missing the obvious here. But how do you count the number of emitted particles at any given time? Imagine a particle emitter that sits in the top of the game canvas, and dropping particles that falls to the bottom. At the bottom there is some "dude" catching the particles and gets a point for each catched particle. There scoreboard may read something like "Points: 4 of 7" and a little while later it may read "Points: 8 of 13". How do you get the 7 and the 13? Link to comment Share on other sites More sharing options...
drhayes Posted May 20, 2016 Share Posted May 20, 2016 I can think of a couple of different ways of doing this. If you make a custom particle class, there's an "onEmit" method you can override to increment the count. You could call "countLiving" on the emitter itself, but that's pretty dependent on what happens to those particles later (i.e. if you kill them or destroy them or re-use them otherwise later). You could also collide the particle with something just off the bottom of the screen and add those to the count as misses, or collide them with something just below the emitter and add them as total. Umz 1 Link to comment Share on other sites More sharing options...
Recommended Posts