Simultaneous Hits

I'm in the process of making a top down shooter game and I have a fairly complex (for me, anyway) spawning script to handle...spawning. The spawning script has just one flaw: it relies on the defeated bad guys to report back to the spawning script when they're dead and gone.

There are times it works too well.

An example bit is here:

function ApplyDamage (shotDamage : int)

hitPoints -= ShotWeapon.shotDamage;
if (hitPoints <=0.0)
    NPCSpawning.currentEnemy -=1;
    NPCSpawning.playerScore +=2;

Basically, the bad guy gets hit by the shot from the player, takes damage and if its enough to kill him he reports back, adds to the score and destroys himself.

So far so good.

Unfortunately, the player has access to a "spray" type of weapon. Like in Super Contra, or Smash TV and I'm sure every other game in the genre. When multiple bullets hit the bad guy (and kill him), the bad guy "dies" many times--once for each bullet.

In a game that's supposed to have 8 on screen it's possible to get in to the twenties. Easily.

Therefore, my question is this:

How do I fix it?

could just add sg. like `bool isAlive;` and set it to false where you call Destroy and also add it to the condition so it only ends up true if `hitPoints<=0 && isAlive` is true too