The explanation of the item change glitch
here was wrong. There are two ways to implement this glitch, and I had confused them. Now I shall give its detailed description, dividing it into several parts. I assume you use
this utility script to watch sprite info and so on. I would thank gocha for the sprite info lua and ISM for his research on this glitch.
The number of sprites and id number divisions
The largest number of sprites which can exist on screen at the same time is 12 (the above script displays sprite id numbers by #00-#11). When a sprite appears, its id number takes the largest value it can take. If it is generated from a block or the resereved box, its possibly largest id number is #11 (except the case of yoshi); on the other hand, if it is generated by scrolling or some sprite generators (lakitu throwing spinies, chuck kicking rugby balls, bullet bills, and so on), its possibly largest id number #0X is usually #09, and may take a less value depending on the existence of kinda special sprites in the level such as wigglers, sumo brothers (K.Ks), bubbles, or lakitu. Let us name the id number division #00-#0X a
first division, and the rest a
second division. Those are only sprites generated from a block or the reserved box which can exist in both of the first and the second division. When the first division is filled, no sprites other than a goal gate can be generated by scrolling or sprite generators.
Item change glitch and overwriting a sprite
When a sprite (other than yoshi) is generated from a block or the reserved box while both of the id number divisions are filled, the sprite which earlier appeared among the two sprites of id #10 and #11 will vanish. If yoshi is about to eat the vanishing sprite in this situation (or in other words, if it's on yoshi's tongue), then the newly appearing sprite will be attracted on his tongue. It would be kinda better to call the glitch somthing like a sprite attract glitch.
Overwriting a sprite by a goal bar
A goal bar is very special in the sense that when the first division is filled it can overwrite an already exsiting sprite other than some sprites such as a key, p-switch, springboard, (small) yoshi and his egg (a goal bar cannot appear when the first division is filled by such sprites as above since it can exist only in the first division; it'll become able to appear after one of them is killed), and so by generating a goal bar while the first division is filled by unexceptional sprites, the sprite on yoshi's tongue which will be overwritten by the goal gate will turn into the bar as above.
Sample:
http://dehacked.2y.net/microstorage.php/info/1540701508/smw-itemchange-sample2.smv
Item change glitch and "eat air" glitch (cf. "hold air" glitch of DKC2)
When
yoshi eats one powerup (including a reserved powerup) twice (more precisely, when yoshi eats it at the same time mario gets it), yoshi will be eating "air" for a while. In this situaion, a new sprite which appears on the same id number as the powerup overwrite the "air" and so appears on his tongue. If you want to implement this with such a sprite appearing only in the first division as a goal bar, you would have only to fill the second division (if necessary) in such a way that the powerup will appear in the first division.
Samples:
http://dehacked.2y.net/microstorage.php/info/288580167/smw-itemchange-sample1.smv
http://dehacked.2y.net/microstorage.php/info/1565346922/smw-itemchange-sample3.smv
Most sprites would be swallowed after the glitch is implemented, so you may have to use them before they get swallowed, or have to cancel his swalloing them by taking damage.
This glitch is still under research and I don't understand everything of course. Feel free to ask any questions and point out anything you find.