How to count items on screen?

Get help using Construct 2

Post » Tue Sep 18, 2012 12:07 pm

Hello everyone, I've got a problem with a kind of puzzle game I'm trying to make. On each screen there are some balls that the player has to destroy (think of something a bit like puzzle bobble). I'm trying to make a counter to see how many balls are on the screen at each time, but I can't find the right funciont to do it. Until now, I was using something like this:
>System / Every tick
>System / Pick all "ObjectA"
>System / Pick all "ObjectB" -> Variable Set var to objectA.Count + objectB.Count

I then dump that var into a text object on screen each tick.

The problem is that when there are no instances of ObjectA, for example, the counter just stops working. Is there any other way to count how many instances of more than one object type are there?
B
9
S
1
Posts: 5
Reputation: 741

Post » Tue Sep 18, 2012 12:29 pm

Just " Every Tick -> Set var to A.Count+B.Count " should do the trick. The reason it's not working is the "Pick all" conditions. The event doesn't run when there are no instances of either of the objects.Nimtrix2012-09-18 12:31:07
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Tue Sep 18, 2012 3:30 pm

Thanks a lot, that did it. I thought I needed some "Pick all" conditions in order to be able to use those .Count funcions.
B
9
S
1
Posts: 5
Reputation: 741


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests