Counting instances that meet a condition

Get help using Construct 2

Post » Mon Apr 07, 2014 10:34 pm

Hey everyone,

Is there a way to count how many instances of an object meet a certain condition?

For example, let's say I have 5 instances of the same object, but each with different animation frames. How could I check the count to see how many are currently playing an exact frame? Is it possible?

Thanks!
B
124
S
43
G
41
Posts: 849
Reputation: 28,235

Post » Mon Apr 07, 2014 10:38 pm

The PickedCount expression is the way to go I think

PickedCount
The number of instances meeting the event's conditions. For example, if the event has the condition "Mouse is over Sprite", Sprite.PickedCount will return the number of Sprite instances that the mouse is over.


https://www.scirra.com/manual/133/common-expressions
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Mon Apr 07, 2014 11:02 pm

Aphrodite wrote:The PickedCount expression is the way to go I think

PickedCount
The number of instances meeting the event's conditions. For example, if the event has the condition "Mouse is over Sprite", Sprite.PickedCount will return the number of Sprite instances that the mouse is over.


https://www.scirra.com/manual/133/common-expressions


I think that might be it, alright. Thanks!
B
124
S
43
G
41
Posts: 849
Reputation: 28,235


Return to How do I....?

Who is online

Users browsing this forum: newt, ST314 and 27 guests