If all instances meet condition?

Get help using Construct 2

Post » Thu Aug 21, 2014 1:39 pm

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".
ImageImage
Mr. Green - Platform/puzzle game out now!
B
25
S
7
G
1
Posts: 222
Reputation: 3,350

Post » Thu Aug 21, 2014 1:59 pm

Try adding the condition 'Object.pickedCount = Object.count'
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Aug 21, 2014 2:22 pm

@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:
AllObjectsTrue.capx
You do not have the required permissions to view the files attached to this post.
Last edited by OddConfection on Sun Aug 24, 2014 2:26 pm, edited 1 time in total.
Find all the Construct 2 games that were on Steam Greenlight here
B
36
S
10
G
7
Posts: 475
Reputation: 7,015

Post » Fri Aug 22, 2014 1:43 pm

Thanks guys! Problem solved. Much appreciated.
ImageImage
Mr. Green - Platform/puzzle game out now!
B
25
S
7
G
1
Posts: 222
Reputation: 3,350


Return to How do I....?

Who is online

Users browsing this forum: Cubeeo, monster4096 and 6 guests