Board Thread:Questions and Answers/@comment-24386245-20140810124312/@comment-24386245-20140810222444

SquareFingers wrote:

If the next enemy appears as soon as one dies, you don't need to do anything more than write all the new enemy's details to the respective variables. If it helps you, don't think that the enemy dies - think instead that the enemy gets teleported (and possibly transformed, if there are multiple enemy types).

Ok, this makes sense.

TriforceOfKirby wrote: You can use SPSET to overwrite the old sprite if needed.

One way to check if the enemy has died, is with the SPCHK command, for it to work, all enemies will need to have a continuous idle animation, and then when they are supposed to die, a 1 time death animation. After the animation is over, SPCHK(N)AND 8 will result in FALSE(0), where N is the control number of the enemy.

With the FALSE output, you know that the enemy has died and a new one can take it's place. You can simply use a FOR loop to go through all the enemy control numbers when a new enemy is supposed to spawn: @SPAWN FOR I=1TO 16 '1-16 are the control numbers used for enemies IF!(SPCHK(I)AND 8)THEN SPSET I,0,0,0,0,0:I=16 NEXT RETURN

With this, it uses SPSET to spawn the new enemy using the control number of the first non-animated(dead) enemy it can find, if it fails to find one(all enemy control numbers are being used), it just skips the spawning.

So does this. Thank you!