Counting Particles

0 favourites
  • 4 posts
From the Asset Store
Perfect Particles
$2 USD
80% off
Particles support animations, collisions, effects and etc.
  • From the manual:

    "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."

    How?

    I have put my particle generators into a family so that I can use a For Each loop, and I have a text box that is set to count the total number of particles, but it's only showing me one instance. I've also tried using 'add' instead of 'set', and I just get an ever increasing number.

    I know this should be pretty simple, but I just can't seem to get my head around it.

  • Would this work?

    system every tick set global variable ParticleCount to 0

    system for each particle object

    trigger once

    • add object.particlecount to global variable ParticleCount

    system every tick set text: ParticleCount

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Would something like this do the trick ?

    I didn't put any evaluation every tick, just made a function to count with a local variable. P1 and P2 (particle spawners) have different rates, I display the respective count, and the total.

  • Interesting... it seems you have to use the add command, as well as using a static local variable.

    Thanks everybody!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)