OblivionSkull21
Member
I'm setting up something where, when a drawn, moving sprite reaches the edge of a certain object, it triggers something. The object "obj_fire" is a child of "obj_lightparent".
There's a separate instance that draws the moving sprite and tells obj_lightparent what to do once the sprite reaches that object's edge.
This works fine if there's only one object in the room with the parent: obj_lightparent.
However, if I have 2 or more of the exact same object in the room with that parent (i.e. two torches), there's an issue where the moment the drawn sprite touches the edge of the the first object, it also triggers the other object, which is NOT what I want.
I want each object to run the code independently and not be triggered by other instances of that object meeting the drawn sprite.
How would I do that? I tried using id, other, etc. with no luck. It seems the x in the above code is what needs to be changed.
There's a separate instance that draws the moving sprite and tells obj_lightparent what to do once the sprite reaches that object's edge.
Code:
with (obj_lightparent){
global.sx = (x - (sprite_get_width(spr_light)/2*image_xscale)); //start of sprite
.................other code that is irrelevant
}
However, if I have 2 or more of the exact same object in the room with that parent (i.e. two torches), there's an issue where the moment the drawn sprite touches the edge of the the first object, it also triggers the other object, which is NOT what I want.
I want each object to run the code independently and not be triggered by other instances of that object meeting the drawn sprite.
How would I do that? I tried using id, other, etc. with no luck. It seems the x in the above code is what needs to be changed.