Help with simple circuit.

Get help using Construct 2

Post » Wed May 08, 2013 12:35 pm

Hi,

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



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
B
50
S
16
G
9
Posts: 1,098
Reputation: 11,237

Post » Wed May 08, 2013 12:51 pm

Pathfinding could be adapted to solve that :)
B
24
S
9
G
7
Posts: 756
Reputation: 7,312

Post » Wed May 08, 2013 2:46 pm

@vee41

Thanks for the quick response. Never used pathfinding but will take a look
B
50
S
16
G
9
Posts: 1,098
Reputation: 11,237

Post » Wed May 08, 2013 3:17 pm

Maybe checking if a junction box is overlapping the paths, and giving instance variables for each light, corresponding them to their light ways.
Image
B
108
S
24
G
18
Posts: 1,373
Reputation: 22,824

Post » Wed May 08, 2013 3:31 pm

@TELLES0808

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
B
50
S
16
G
9
Posts: 1,098
Reputation: 11,237

Post » Wed May 08, 2013 3:59 pm

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?TELLES08082013-05-08 18:29:50
Image
B
108
S
24
G
18
Posts: 1,373
Reputation: 22,824

Post » Wed May 08, 2013 5:51 pm

@TELLES0808

Right i think i get the idea, never really thought about it being a 'real' connection but i guess it should work. Thanks
B
50
S
16
G
9
Posts: 1,098
Reputation: 11,237

Post » Wed May 08, 2013 11:03 pm

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 ! Magistross2013-05-08 23:42:09
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735

Post » Thu May 09, 2013 12:09 am

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

https://dl.dropboxusercontent.com/u/47035927/Samples/light.capx

https://dl.dropboxusercontent.com/u/47035927/Samples/light/index.htmlTELLES08082013-05-09 00:13:49
Image
B
108
S
24
G
18
Posts: 1,373
Reputation: 22,824

Post » Thu May 09, 2013 1:13 am

@TELLES08080 Very clever way of doing things. However, it doesn't seem to be doing exactly what spongehammer wanted.
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests