I made this code a bit ago, I don't know if other people have made this before. But, I did make it by myself. :D It is best for a game menu or buttons you want to put all in one sprite instead of multiple sprites. You can use it if you want, Give credit if you feel like it.