B
Brickyoyo
Guest
I'm having trouble coming up with a solution to this problem.
So I have multiple instances of the same object (obj_switch) and in the instance creation code, I have a variable set called "channel" which is just a number. I want switches with the same channel number to act together, so if they are all on, then they all set their "powering" variable to true and when just one is off, they are all off.
I came up with something like this (it's in the obj_switch step event)
The idea is if they all run it, they all check each other, but it isn't working.
Sorry if this is confusing.
So I have multiple instances of the same object (obj_switch) and in the instance creation code, I have a variable set called "channel" which is just a number. I want switches with the same channel number to act together, so if they are all on, then they all set their "powering" variable to true and when just one is off, they are all off.
I came up with something like this (it's in the obj_switch step event)
Code:
with (obj_switch) {
if (other.channel == channel) {
if (other.selfpower == true) && (selfpower== true) {
powering = true;
other.powering = true;
}
else {
powering = false;
other.powering = false;
}
}
}
Sorry if this is confusing.