How can I create a Wiring Puzzle?

Hi there, I’m making a top down rpg with puzzles along the way, and I’m stuck on how to make a specific one.

See, I would like to make a wire puzzle. As in, the player have a grid (for example a motherboard let’s say) and they can scroll down or up to choose an horizontal, angled, or vertical wire. They then need to connect two dots with these wires.

Now the wires system works perfectly, but I don’t know how to make the game detect that the starting dot is connected to the ending dot by the wires.

Could someone please help me ?

1 Like

Hi - What have you got so far?
are the dots and wires sprite objects? or are the wires shape painter objects?
do they snap to a grid?
if the wires are sprites then have the origin and centre point at one end A and a custom point ‘end’ at the other end B. For shape painter wires (much harder) use an array of points for each wire (wires[wire.id][point].x, wires[wire.id][point].y). You could also have the wires as a chain of objects connected by physics joints and there are threads on here that would be useful for that.
Build an array that contains the info relating to connections
the dots and wires need a number variable to give them a unique ‘id’
this is either done manually on the editor or at the beginning of the scene using repeat for each object.
then to build the array of connections
repeat for each dot and inside of that repeat for each wire …point A inside dot change - Connected[dot.id].PointA.wire.id and then do the same for point B of the wire.
what i would do is, and this might be frowned upon by more seasoned coders is have the id numbers of wire and dot start at 1 so that 0 is null
i tend to scan through an array and so whether a child is not equal to zero - but i know there are better ways of doing this using array tools!

I helped someone do something similar. Although, it was more basic and used blocks for wires instead of more realistic wires. It might help.

This is the original version. It explains the concept.

https://forum.gdevelop.io/t/collision-instance-and-animation-solved/57043/8?u=keith_1357

If you scroll down further in that post, there is a more advanced version.

https://forum.gdevelop.io/t/collision-instance-and-animation-solved/57043/12?u=keith_1357

You could use collision to detect links or IDs or the built-in linking system.

1 Like

I made 2 different wiring puzzle game as a mini game for my gdevelop game jam’s game.
try hacking a tank or drone, and tell me if its what you need
Rate Neural Override (Gdevelop big game Jam 8) by dskyle77 for GDevelop BIG Game Jam #8 - itch.io