T
TheCount15
Guest
I have a game which has the main character (a light bulb boy) interacting with several intractable electric objects. The electric objects have two main "states" (though no real state system has been implemented yet), where they are either turned on or off as indicated by sprites. I have a system where the player can touch for instance an electric wire and it will change states but I am wondering if there is a way to add an objects variable value to another object. I would like to have each object to have a var electric which I have already clamped at 0 and 100 in a parent object. When an object with an electric var over 1 is touching another object it adds its electric value to the touching object. For instance:
My bulb boy create has:
electric = 100;
My bulb boy step has:
if (collision_point(x,y, electricity, false, false)){
with(obj_wire){
obj.electric += 100;
}
}
This current situation only adds 100 electric to only one of the wires (can be on other side of room) and I haven't been able to make anything work for wire to wire contact either.
What I am trying to accomplish but I still do not understand with statements and the uses of other. I am wondering if I could be guided in the right direction or if someone has an example of how to add an objects var value to another that would help.
Bulb boy ( 100 electric) --- Touches ---> wire
wire now has 100 electric
if wire ( 100 electric) --- Touches ---> wire
both wires have 100 electric
Thanks
My bulb boy create has:
electric = 100;
My bulb boy step has:
if (collision_point(x,y, electricity, false, false)){
with(obj_wire){
obj.electric += 100;
}
}
This current situation only adds 100 electric to only one of the wires (can be on other side of room) and I haven't been able to make anything work for wire to wire contact either.
What I am trying to accomplish but I still do not understand with statements and the uses of other. I am wondering if I could be guided in the right direction or if someone has an example of how to add an objects var value to another that would help.
Bulb boy ( 100 electric) --- Touches ---> wire
wire now has 100 electric
if wire ( 100 electric) --- Touches ---> wire
both wires have 100 electric
Thanks