Multiple enemy error.

Get help using Construct 2

Post » Wed Jan 11, 2017 11:03 am

Message: Vodakman can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hello again.

I've had a similar problem a while back, and @randomly helped me fix the error, but it has returned once again. I tried adding the "For each" condition and "is playing Default" but it ain't working. When I kill one enemy, the others die too. So, what's the problem?

Image:
Image

.capx:
http://www.mediafire.com/file/a4bek8adwb1e9iw/Game.capx
B
7
Posts: 34
Reputation: 345

Post » Wed Jan 11, 2017 3:37 pm

Just looked through your .capx.

The issue doesn't lie in the destroy-event.

It lies in the conditions that subtract the health from the enemies.
Those trigger for every enemy, and that is the problem.

Usually, you choose a "on collision" event. This automatically picks the enemy that has been colliding with the bullet.
But since you are checking for collisions with the hitbox and not the enemy, all enemies are selected and thus, the health is subtracted for every enemy.

This fixes it:
Image
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Thu Jan 12, 2017 6:58 pm

And once again, randomly saves me. Thanks a lot, man!
B
7
Posts: 34
Reputation: 345


Return to How do I....?

Who is online

Users browsing this forum: bluesun66 and 9 guests