How do I count the on-screen objects ?
I tried the following methods and they work, but when there isn't any on-screen object, it still counts 1.
When there are no enemies on the screen then that event won't run so the text doesn't get updated. You can use that first event and add an 'else: set text to 0'.
Develop games in your browser. Powerful, performant & highly capable.
Try Count instead of PickedCount
edit: in addition to ramones's suggestion. Still not sure how that first method produces 1 for you though.
Thanks, I was looking at "Is on screen" at a property, not like a condition. This method works:
Is this good, or is there a better way ?
"Count" picks all the objects, regardless the conditions before (I tried it before opening this thread)... "PickedCount" counts only the objects that respect the conditions.
My first method doesn't work because the condition "is on-screen" becomes 0/false when there is no on-screen object. An expression like "object.CountOnScreen" would had been useful in this case.
Yea sorry, I shouldn't take part in life until my second coffee.
This is what I was saying about adding else:
Thank you very much