Language…
6 users online: AntonioBaptista, gemstonezVA, iforogt, MarsAmPear, PixelFhacks, UTF - Guests: 115 - Bots: 131
Users: 70,234 (2,555 active)
Latest user: kior

Spawning a sprite when all the enemies in a level are killed...possible?

I recently began to think about the custom sprites that make a certain sprite appear when all the enemies on the screen are killed, and there's something about these sprites that has me curious (not a request), would it be theoretically possible to have a sprite which spawns only when all the enemies in the level are killed (not just the screen any current enemies are shown on, but enemies in that single area, regardless of how many screens are used)?

In a way, it would be like the "Destroy Them All!" and "Bash The Baddies!" bonus rooms in Donkey Kong Country 2 and 3 respectively, where you can't get the Kremkoin or Bonus Coin until every enemy is killed, regardless of the length of the bonus room.

Wouldn't such a sprite be able to keep track of how many enemies are left in an individual section of a level? I wish I had a little input on this concept, please.

Anyway, thanks in advance.
Well, there's a sprite that teleports Mario when all the enemies are killed, so I assume one could check for enemies, and if none, activate code and GFX routine...

World Community Grid: Thread | Team
 
Yeah, I've heard of that sprite...but what about the possibility of having a sprite be spawned on the condition that all enemies, near and far away, have to be killed first? In a sense, it probably wouldn't work so well on an auto-scroll level if such a sprite was placed at the start, and even more ineffective if there were hard-to-kill sprites, or ones that come from launchers, shooters, or generators.
I'm pretty sure you could modify the Key Generating and Mushroom/FireFlower/Cape Generating sprite for this.
Yeah, you only need to modify the existing generating sprite codes.

LDA #$78 ; \ set sprite number for new sprite
STA $9E,x ; /

The number in bold is the sprite to generate. Check LM, all.log or this for all of the values.

To generate a custom sprite instead, this might work:

LDA #$xx ; sprite
STA $7FAB9E,x
JSL $07F7D2
JSL $0187A7
LDA #$08
STA $7FAB10,x


However, some sprites such as a Koopa shell might not work. For that, you'll need to change the sprite status, which is the value stored to $14C8,x.

..But if you mean all sprites in a level, this won't work.