Press 1, 2, and 3 to see the mechanic at work. Go inside to see how it works, I put comments inside. Just put the code in your backpack and use it when you want to.
Use if needed, no need to credit, just put a link in the comments of this project to the project that you used this mechanic in, I would love to see your ideas that you make with this.