A chain of objects (for example, an electrical circuit)

Good afternoon, do not tell me how to create a circuit of objects, for example, as an electrical circuit, so that the objects are connected, and in the event of a break from a generator or wire, the circuit would not work.


Well, I’ll tell you anyway! :smile:
I’ll give you an example, but there are probably many ways to handle that problem.
What you can do, for instance: let’s say you have a battery, called A. When you connect a wire to the battery, you give to the wire a variable Batteryname with value A. When you connect that wire to an appliance, you transfer the variable with the value A to the appliance.
And when something happens to any element of the circuit that should break it, you check for all the objects with value A, and you define a variable Broken with a value of True (or any other way to turn off your circuit).
Good luck :slight_smile:

1 Like