How do I count quantity of created object ?

From the Asset Store
112 High-Quality destruction sounds for videogames
  • Hi :)

    Lets say the gameplay is "touch and destroy", so

    1. the game generate/spawn object periodically, and the spawn time increased

    2. Player touch the object to add score

    3. The object destroy after touch

    4. If there is too much object on screen (in certain quantity), it will subtract player life.

    I am looking for the event/condition to count the quantity of the object..

    So far, I am thinking to create a variable as counter,

    everytime spawn object will Add value 1 to that variable,

    and every time touch tap object event to destroy object will substract value 1 to that variable.

    Then system every tick, check the variable if reach certain amount, then subtract player life

    or there is any other way to implement this ? if possible, I want to avoid using "Every tick"..

    Thanks in advance :)

  • Have variable objCount

    On Object Created -> Set objCount to Object.Count

    AND

    On Object Destroyed -> Set objCount to Object.Count

    Then you can compare it when you need.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have variable objCount

    On Object Created -> Set objCount to Object.Count

    AND

    On Object Destroyed -> Set objCount to Object.Count

    Then you can compare it when you need.

    Maverick1912 awesome ! that "[dot]Count" thing really works.

    Thank you so much

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