This code allows Mario to summon the closest carryable sprite, horizontally, into his hands. The closest sprite will be put into his hands instantly as long as he isn't already holding something, and it will also detect kicked sprites. Could be useful for puzzle levels, or Kaizo levels involving summoning sprites in a tight order to perform specific tricks.
Summon is performed by holding X or Y (by default), then tapping L or R.
Usage note: If using in your hack, it may be wise to let the player know that it only measures horizontal distance, not vertical.
Update v1.1: Bug fixes, and made some of jankier "features" of the code into optional defines. Also made a few small optimizations, moved the SFX/Bank to defines, and allowed the user to customize the hold input.
I enjoyed making a level using this in my hack, Very cool and customizable with 0 jank, I don't know jack about asm but maybe you could measure total distance using distance formula, otherwise its great I love it
Works well with the different settings and seems like an awesome mechanic, especially for Kaizo, so it's accepted. Previous rejection was sort of a mistake (spring duplication), since I was unable to replicate it.