you use arrow keys to move the yellow and orange thing is the pipe. if you go into one end, you will quickly come out the other. you can toggle mode 1 or 2 using the numbers 1 and 2 respectively. modes are the way you enter the pipe. mode one checks if you are at the end of the pipe and which side by color, and mode 2 checks if you are touching the pipe and which direction you want to travel in based on whether you've went left or right before touching the pipe. enjoy i guess...my dumb experimentation.
a long time back. wanted to make something like this but i didn't, because i had other priorities. now i remade the thing and it works like a charm. you can look into the project to see what the variables mean. it's quite simple actually.