How do I Count objects with a specific instance variable val

Get help using Construct 2

Post » Fri Apr 18, 2014 3:25 am

Lets say I have 15 instances of Sprite.
Sprite has an instance variable called "true".
The value for true will be either "0" or "1".

The user controls position of Sprite.
Sprite.true will depend on it's location defined by the user.
I need to know how to: Count each Sprite where Sprite.Ture = "1" Every Tick.

I thought it would be something like:
{ For Each "Sprite", Sprite.True = "1" [ Add 1 to Global_Variable(Count) ] }

This works as a once off count, but obviously not in real time.

Any thoughts?
B
7
S
1
Posts: 43
Reputation: 513

Post » Fri Apr 18, 2014 5:43 am

Clean and simple... You can always change that the PickedCount get put into a variable. But now you know where to find it :D
You do not have the required permissions to view the files attached to this post.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Sat Apr 19, 2014 10:30 pm

I must be over thinking things and not seeing whats right in front of me. thank you
B
7
S
1
Posts: 43
Reputation: 513

Post » Sat Apr 19, 2014 11:41 pm

NP It always take second eyes to help.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests