Quick Counting Question

For questions about using Classic.

Post » Sat Oct 13, 2012 10:47 pm

Is if possible to count (system -> count objects) the number of objects that have the same variable count.

Example:

16 objects that are the same.
5 have the value of "1" in (Variable)

Always
Global var (Count) = Object with (Variable = 1)
(Count) = 5
B
3
S
1
Posts: 59
Reputation: 568

Post » Sat Oct 13, 2012 10:49 pm

You can do a "For Each object" loop and then if the object has variable count 16 add 1 to a global variable
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sun Oct 14, 2012 12:31 am

Problem with that is it will keep adding
B
3
S
1
Posts: 59
Reputation: 568

Post » Sun Oct 14, 2012 2:21 am

Putting the For-Each-Object loop as a sub-event of a "Trigger once" event should fix it =)
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sun Oct 14, 2012 3:16 pm

Jayjay's solution works, here's the implementation.

CC r2 cap:
http://rghost.net/40933729
B
11
S
2
G
3
Posts: 100
Reputation: 2,150

Post » Sun Oct 14, 2012 4:54 pm

Thanks @Zotged =)
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests