Not sure if this is Level ASM, or would simply be something that needs to be inserted into a sprite's code - but I would like to request help with finding a way to teleport the player to either a screen's specified exit, or to a specific level/exit defined in code when the player is damaged by an enemy. Ideally, the player would not take any damage when this happens though (i.e. if Cape Mario is hit in the bonus level with this ASM, when teleported back to the main level he would still be Cape Mario instead of Super/Small Mario)
I imagine this to function very much like Donkey Kong Country 2 and 3's Bonus Games. This video demonstrates the behavior well:
When raocow hits the bee at 10:20, it teleports him out of the bonus game and back to the level.
It would be extra cool if a sound effect could play when this happens, but since I am not certain how complex this request is I don't want to push it.
Let me know if any clarification is needed. Thanks!
The linked patch is pretty close to my request, but since it is a patch it would happen for the whole hack. I'd prefer the teleport on hurt to happen only in specific levels. My first thought is that maybe this code could be converted to UberASM to allow for individual level insertion, but it would also be awesome to be edited to warp the player when they get hurt/touch an enemy as opposed to when the player would normally die.