A
Arrogant
Guest
I have a problem with wanting the same objects to be separate from one another. I have a button which when activated it powers a object called wire, although it will power all the wires if only one of them is touching the button (GIF of the problem: https://gyazo.com/c6d769055e9aba089b9a1af6da0d31f7).
Step event code of the wire:
Step event code of the button:
So how would I go about only changing the state of the wire which is touching the button instead of all the wire objects? Also as shown in the GIF, only one of the buttons powers the wire, how could I change this?
Please excuse me if the problem is obvious, i'm very tired
Thanks in advance.
Step event code of the wire:
if(place_meeting(x,y, obj_wallbutton) && obj_wallbutton.powered == 1)
{
image_index = 1;
}
else
{
image_index = 0;
}
{
image_index = 1;
}
else
{
image_index = 0;
}
Step event code of the button:
if collision_rectangle(x+7,y+7,x+14,y+14,obj_clight, false, true)
{
image_speed = 0.5;
if(image_index == 15)
{
powered = 1;
image_speed = 0;
image_index = 15;
}
}
else
{
image_speed = -0.5;
if(image_index == 0)
{
powered = 0;
image_speed = 0;
image_index = 0;
}
}
{
image_speed = 0.5;
if(image_index == 15)
{
powered = 1;
image_speed = 0;
image_index = 15;
}
}
else
{
image_speed = -0.5;
if(image_index == 0)
{
powered = 0;
image_speed = 0;
image_index = 0;
}
}
So how would I go about only changing the state of the wire which is touching the button instead of all the wire objects? Also as shown in the GIF, only one of the buttons powers the wire, how could I change this?
Please excuse me if the problem is obvious, i'm very tired
Thanks in advance.