0 Favourites

# Help with simple circuit.

• 18 posts
• Hi,

i am trying to figure out the logic to make the circuit work. Any suggestions gladly accepted.

<img src="https://dl.dropboxusercontent.com/u/1685424/circuit.JPG" border="0" />

The red box is the power source, blue circles are lights and the black circles are junction boxes. Ideally i want a way create a way to turn off the relevant light when one ( or more ) of the junction boxes is removed.

The logic would need to apply to any circuit created not just the one above.

I cant get my head around where to start really.

Thanks

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Pathfinding could be adapted to solve that :)

• Thanks for the quick response. Never used pathfinding but will take a look <img src="smileys/smiley1.gif" border="0" align="middle" />

• Maybe checking if a junction box is overlapping the paths, and giving instance variables for each light, corresponding them to their light ways.

• I sort of tried that but i ended up with something very fixed which only applied to the circuit above. I wanted something which would apply to any circuit with multiple paths ( within reason of course ).

It may well be part of the answer but everytime i think about it my head fills with mud <img src="smileys/smiley5.gif" border="0" align="middle" />

• Try this:

Make an instance Boolean the circuit branch sprite.

If it's overlapped by the black box, set the Boolean to false, if it is overlapping another circuit branch with Boolean false, then, it's false too.

The logic is simple and will always work on any new configuration.

I'll make a sample for you, but now I can't do it on the job.

Make sure to always overlap one pixel between each circuit branch, to check their contacts (like in a real world? lol)

Conditional:

Circuit is NOT overlapping Black Box;

Circuit is overlapping Circuit Family (or each circuit individually, sorry);

Circuit Family Instance Boolean = True;

---------> Set Circuit Branch Instance Boolean = True;

Then, you will have light!

Else, if the circuit branch is overlapping a black box, or, the another circuit branch is not already TRUE, then, it will not be true.

It's like following the energy path by checking the branch.

Also, the first branch need to be always True, because it's energized, alright?

• Right i think i get the idea, never really thought about it being a 'real' connection but i guess it should work. Thanks

• Here's a more "programmer" way of doing such circuits. Might be a little bit too complicated though...

https://dl.dropboxusercontent.com/u/7004246/circuit.capx

First time doing recursivity in C2... and man was that a pain ! <img src="smileys/smiley36.gif" border="0" align="middle">

• Magistross I prefer the visual way because functions are too much advanced =]

• TELLES08080 Very clever way of doing things. However, it doesn't seem to be doing exactly what spongehammer wanted.

• Magistross ops, my bad, leaving it to spongehammer solve and post to Us xD

Maybe, instead of destroying the box, it could change to another frame, and by checking their frames, he could achieve what he desired.

• Thanks for the demo. Its close but the way i envisaged it would be that if there was another power route to the light and a junction was removed the light would still come on.

Thats much closer although its very complex <img src="smileys/smiley1.gif" border="0" align="middle" /> I didnt want the connecting wire to disappear but i suppose thats an easy fix.

I would need to concentrate very hard to see how you had done it Ha.

Thanks to you both for your effort.

• spongehammer download again, I have updated the sample by placing 3 new ramifications on the latest light.

That's the best I can do with your explanation about the problem...

• Thanks ! Thats great. Thanks for your time <img src="smileys/smiley20.gif" border="0" align="middle" />

• I was destroying the wires because to me it didn't make any sense keeping them. The circuit would look like current could go through while in fact it doesn't... maybe junction should be able to be turned on and off in their capacity of distributing power !

Anyway, unconnected wires are dangerous ! <img src="smileys/smiley36.gif" border="0" align="middle" />

• 18 posts