If all instances meet condition?

0 favourites
  • 4 posts
  • I have searched and cannot find a solution to this, so accept my apologies in advance if I've missed something obvious but anyway...

    I have a game where there are multiple instances of an object on screen. The object has different animations to represent the different stages of it's life span but should never be destroyed.

    So the animations are "life0", "life1", "life2", life3" etc

    What do I need to do so that:

    If all object instances are playing animation "life0" ---> action

    *edit*

    Just to clarify I have used: Object is playing "life0" but the action kicks in as soon as the first object hits "life0" but I need the action to only trigger once ALL objects are playing "life0".

  • Try adding the condition 'Object.pickedCount = Object.count'

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • FredQ

    Codah's solution should work, but here is an alternative since it's good to have options.

    Set a variable to true, then loop through the objects with a for each, checking the inversion of some condition, and setting the variable to false.

    If after the loop has run the variable is still true, then the condition must be true for all instances of the object.

    Here's an example where it only sets the text to true if you've clicked all the sprites:

    [attachment=0:3m2lwnf8][/attachment:3m2lwnf8]

  • Thanks guys! Problem solved. Much appreciated.

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