# Count all objects on the scene inside the event, the condition of which limits the objects

Hello. Is it possible to apply a function to all objects if it is nested in an event, the condition of which has already selected some of these objects?
For example, there are 10 Objects. In the event condition, I check for Object collisions and Obstacles.
As a result, only the Object that will collide with an obstacle gets into the current event. If I call the count (Object) function it returns 1. But I need to get the number of all objects in the scene(10) …
I understand that it is possible to create a variable for this purpose. But the question is, is it possible to get the entire set of objects from within the event, the condition of which limits the selection result? I am asking more in order to find out if there is such an opportunity(and not only for counting), and not in order to solve the current problem.

In fact, it is better to imagine that if only two or three objects in the object group meet the conditions, and we do not know which of them are. However, after we use the condition in each object, the subsequent operations will only target the qualified objects

I think it will be clearer this way

There are some bubbles in the scene. And when it collides with an obstacle, it checks whether it is the last bubble. If yes, the game ends. But the problem is that in this context the result of the “Number of objects” function is always 1 … And not the total number of bubbles remaining …

Parent conditions apply to children.
You have a parent condition that says bubbles is in collision and a child condition saying there are no bubbles.
So you are asking “when there are zero bubbles and when one bubble is in collision”…do you see the problem?

The remaining total can be obtained by using the condition that there is no collision for each object

1 Like

Yes, I understand. Maybe I can’t formulate the question correctly) I mean, is it possible from the child event to apply the “Number of objects” function (and other functions) not to the result of the parent event, but to all objects on the scene globally? Because sometimes such a need arises. Something like that:)

For example, I could create a Bubbles2 group and check the number of objects in the scene or solve the problem in another way, but this is inconvenient … I thought it might be possible to refer to all objects, if necessary, without additional code. Sorry for my English)

You understand but you don’t understand
You need to move the child event OUT of the parent event, so that the parent condition doesn’t apply.

1 Like

ок)))
Maybe someone will understand me)))

The problem is not nobody understand but that you resolve the issue applying the Gruk’s advices.
Because eveybody i think, has understand what is your problem.
Ok?

2 Likes