Skip to main content

Level Complete

·357 words·2 mins

Yesterday I started working on the level transitions. Previously, the only indication a player got that they solved the puzzle was a tiny little check mark on the laser sensor. Then they had to click the level buttons themselves to transition.

So I wrote some code that detects when all the sensors in the level have been triggered and pops up a message.

Super basic but it works.

Those sensor sprites are new, too. When a laser hits the sensor dome, the little lights on the side light up one at a time. This adds a delay to make sure the player didn’t just have the laser beam quickly pass by the sensor. It’d be annoying if that triggered a level transition.

Although, maybe that delay wasn’t necessary because now I realize I need to wait until the mouse has been released before the sensor should be activated. I do want the lasers to move around in real time but I don’t want the sensors activated while the player is still making changes to the mirrors and prisms.

Switched the popups so instead of using Node2Ds I’m using Windows. I’d hoped it would prevent interaction with the game in the background—and it did help—I still ended up adding a global property allowing me to disable game input by hand.

So I need to restructure from using inheritance to composition. I’ve got two major concerns that are fighting for territory in the Interactible class. One concern is drag and drop. The other concern is laser collisions. Right now most of the collision handling code is in the Laser class, but that includes collisions with rectangular prisms, triangular prisms, mirrors, sensors, and walls.

Sure, Laser can handle what happens when a ray is refracted but it shouldn’t be the one deciding whether a Mirror should refract or reflect or absorb. This is only going to get worse as I add lenses, translucent mirrors, and dichroic mirrors.

Drag and drop should be a component, not part of a parent class. Same for rotation.

But I’ll start with something smaller while I figure out how this works in Godot.