Problem with Death Counter

For questions about using Classic.

Post » Thu Apr 07, 2011 5:29 am

Hey all,

I have a death counting system, which is meant to trigger the next wave after so many enemy deaths. However, if multiple enemies die at the same time, the trigger only goes up once, instead of once for each enemy that dies. Is there a way to make it go up for each enemy death?

Thanks
B
1
G
1
Posts: 7
Reputation: 439

Post » Mon Apr 11, 2011 9:48 am

Yes, you'll need to add or substract from a value every time an enemy dies, but for that I'd need to see the .cap or part of the code, where an enemy dies. How you've done it? On collision with something?

Enemy collides with a bullet - destroy enemy, add one to a global "enemiesdead"
enemiesdead = 100 - start new wave, enemiesdead set to 0

I'd do something like that, but without seeing your code, it's just guessing.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Mon Apr 11, 2011 4:20 pm

Sometimes if a condition is satisfied by multiple objects at once, it will only be triggered once, depending on the type of condition or which object plays which role, ie
On Enemy collides with Bullet
Or
On Bullet Collides with Enemy


I think one of those two will work the way you want it to. Don't know for sure without testing tho.
A surefiire way though, is as a subevent for the condition that kills the enemy do a For Each Object

On Enemy collides with Bullet
----System - For each object : Enemy
-----------------destroy, and increment death count
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests