Count instances

Get help using Construct 2

Post » Sat Aug 11, 2012 5:17 am

Hi everyone,

I would like to know how i can check if all the instances of an object type in a layout are destroyed. What i have tried is to create a global variable named XXXX, then in everty tick i set that variable to object.Count. Then i check if XXXX is <= 0. The problem is when i crate the global variable i can't set the initial value to object.count. Is there a better way for this?

Best regards
B
6
S
1
Posts: 30
Reputation: 977

Post » Sat Aug 11, 2012 11:11 am

If you set the variable every tick, it should always contain the object count, I don't see why you need to set the initial value. But you probably don't need to use a variable for this though, you can use "System: Compare two values" and check if "object.Count <= 0".
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Aug 11, 2012 1:09 pm

Yeap, setting a variable to store a value you can call anytime is wasteful. Especially since you'll be doing it on every tick. Meaning it would just be an exact copy of the value.
B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Sat Aug 11, 2012 2:47 pm

You are right. Thank you for your help.
B
6
S
1
Posts: 30
Reputation: 977


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, randomly, spcsmrf, Yahoo [Bot], Zakeru and 18 guests