How do I Display enemies.count

Get help using Construct 2

Post » Tue Feb 07, 2017 12:23 am

I know this sounds simple, but for some odd reason, my sprite fonts wont display the correct enemy count on screen...

Im doing a simple on Enemy create or enemy destroy, display the enemy.count in text. It doesn't register if I destroy the first enemy, so when theres 1 left, it says there's 2 left. What's even more odd is if I have it update text 1 second after the creation of destruction of an enemy object, it refreshes to say there's 0 enemies left :x :x This is happening for any objects I try to display their count on.

Image

The family is "enemy" so there are multiple objects that are a part of it, but it should still display properly.
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Tue Feb 07, 2017 12:37 am

It's a catch-22. In order to call On destroyed, it still needs the object to call it on, so it hasn't actually been fully destroyed yet. Put a Wait 0 ahead of the Set text, and it should work.
ImageImageImage
B
71
S
22
G
247
Posts: 3,756
Reputation: 137,558

Post » Tue Feb 07, 2017 1:31 am

blackhornet wrote:It's a catch-22. In order to call On destroyed, it still needs the object to call it on, so it hasn't actually been fully destroyed yet. Put a Wait 0 ahead of the Set text, and it should work.


I tried that before as well. When I put wait 0 seconds, it updates to show the count as 0 enemies
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Tue Feb 07, 2017 2:02 am

You'll have to provide a sample. The quick sample I did worked.
ImageImageImage
B
71
S
22
G
247
Posts: 3,756
Reputation: 137,558


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 41 guests