This is my laser sensor, which can detect two types of objects! The first is the mouse cursor, and the other is that pile of slime there. Click the flag, and try moving your cursor in front of it! It also calculates the distance from the laser. You can move and hide the slime, by dragging it/pressing A or pressing S. 2/1/2021 SHUTDOWN Update! Press Space to shut down. PATCHES 1. I suppose this isn't a patch, because nothing was fixed. A bug was found though! Don't press the stop sign until the circle is inactive. On that matter, don't press the stop sign! The code will shut itself down without problems if you press Space. 2. Fixed Slime being moveable and hideable after shutdown. 3. Fixed sensing slime and cursor on top of the gray part of the center module. It didn't make any sense, seeing as either object was not touching or in front of the sensor. 4. The laser constantly rotating was getting annoying, so I added a function for stopping it. Press R to toggle the laser's rotation. 5. Fixed a bug from patch two where the Slime was not able to hide, due to the code constantly repeating itself hiding then showing the slime a split second after. As a reminder, S to hide the Slime.
I was thinking about the mechanics of a basic platformer, when my mind came to "slope detection". I started thinking about different types of detection, and voila! A laser detection system! I don't know how I got from "Platformer" to "laser", but I did. Oh well! Code and art by me, and as always, have fun!