Chain colliding objects together

When I click one of the open switches, there is an event that change the line that is in collision and turn it red.
I want to kind of chain them so that if the line that is red, the next line also turns red.
(vertical line turned red and I want the horizontal line to also turn red.

There’s an “Effect is enabled” condition.
So, if object is in collision with other object, and if effect Red of object is enabled, activate effect Red of other object?

Yes. Sorry I did not explain in the post.

The next to last event sets the effect of the first line to enable -The red line you see in the screenshot.
The last event I try to set all lines that have collision with a line with the effect enabled should also enable the effect. But this doesnt trigger.

The problem lies with the last 2 events. The conditions of the second to last event will only result in 1 Ledning1 object being selected (in your example) - the one touching the closed SwitchStright object.

In the last event, the first condition will only be using that subset of 1 Ledning1 object. That list will never include the black line.

And if you did manage to get the black Ledning1 object included, it would get filtered out by the last condition of the last event in the screen shot.

My suggestion to fix this is to create a separate object, with an object the same shape, size and orientation as Ledning1 (say called LedningHitChecker), and use that for collision checking. Something like :


Note, this only works for the red Ledning1 objects touching a switch. You’ll need to modify the events if there’s to be a chain reaction. Let us know if you need help - it can be a tad tricky to make recursive events.

I played around with it and havent really figured it out yet.

The first object Ledning1 is in collision with the switch and turns red.
This works in my code and I can toggle it on/off.

The next Ledning1 that is in collision with the first Ledning1 should then also have its effect enabled and turn red etc. It is the last event that is an issue not triggering I think.

I tried some more…
Is “Effect enabled” and “Effect yes” the same?
-Because I set the effect “ColorRed” to yes in another event where a Ledning1 is colliding with the switch, and here I am checking if it is “enabled”, not if it is “yes”.

I implemented a simpler solution that is okay for now.
-just changing the color of the switches.

Yes. The condition is asking if the effect is enabled. That action is setting the state of the effect to enabled.


As in my 3rd paragraph earlier - that won’t work because the action will only be performed on red coloured Ledning1 objects. That’s what the Effect "ColorRed" of Ledning1 is enabled does. It filters the list to just red coloured Ledning1 objects. And then performs the actions on that list.


Up to you - it’s your program, though I’d personally pursue the original desired effect.