Count objects.

New releases and general discussions.

Post » Fri Sep 18, 2009 2:54 am

I would like a more efficient condition where I check the amount of a specific Sprite there is in the layout. Right now I use the "Compare" expression from System to create this condition, because it's the only way. I use this to determine if some event groups should turn off if there are zero of a certain sprite in the layout.

Problem is, whenever I compare that and the answer is "zero", the debugger feels the need to tell me that, and it gets frustrating starting up a debugging session only to have to click a bunch of OK-buttons to get started.

Maybe there is already a work-around? I tried setting a variable to the amounts of a sprite but it still happens.
B
5
S
2
G
3
Posts: 234
Reputation: 1,818

Post » Fri Sep 18, 2009 7:10 am

There is an expression for families to get the number of objects in the family.
Works perfectly well even if there is only one object, but multiple instances of the same object.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Fri Sep 18, 2009 9:25 am

Sorry, it's a limitation in the debugger - you can either run your application normally, or just ignore all the messages on startup and carry on (they only show once).
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests