Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

Thanks for checking out my game :)
I programmed this in Godot, and I had a hell of a time working out the cable mechanic hahaha, cause I'd never done something like that. I did it so that when you click on a plug it instances a new cable (which is made of a line2d with 2 points) and sets the position of that plug as the start point, and sets the end point as being at the position of the mouse so the cable follows your mouse. Then when you click on a second plug it sets that plug as the end point. And then I used some bools to track things like if a plug was occupied to figure out if it was receiving power

So we had a similar system then, since my cables also used line2ds.

Did you use the on_mouse_entered/exited signals to tell when the cables could be destroyed? Since I did and they were wildly inconsistent.

Not exactly, I made a function to tell me when the mouse was within 10 pixels of the line from any point, and then if a right click occurs it queue_frees the line. It wasn't a great solution though because if lines are overlapping and you right click near them all the lines get deleted. And there was some other funky behaviour when if the mouse was moving fast away from the line as you click it doesn't register as being near the line, so I had to track the mouse positions and add it to an array so it can use the position when the click was started, not when it finishes. Hopefully that makes sense haha

That makes sense. It seems like you essentially coded the mouse_entered signal yourself, which if my experience is anything to go off was probably the right call. I was able to generate an area 2d with a collision box aligning with the bounds of the line, I just couldn't get the cursor to collide with it, but with a bit of experimentation it might be a better solution than mouse_entered or manual proximity detection.