flyinian
Member
I have instances that the player can set on fire.
If these instances are close to one another, the player can interact with all of them at the same time.
What can I do to prevent this from happening.
Code(Step):
Thanks.
If these instances are close to one another, the player can interact with all of them at the same time.
What can I do to prevent this from happening.
Code(Step):
GML:
if(distance_to_object(Obj_Player) < 30 && !_SetonFire){
_Close = true;}
else{
_Close = false;};
if(keyboard_check_pressed(ord("E")) && _Close){
_SetonFire = true;
show_message(string(id) +" : "+ string(current_time)); // When I have this, it only sets one instance on fire. W/o it, it sets all interacted instances on fire. Is this because the show_message halts code?
};
- I know that I could potentially prevent this by shrinking the distance to the object, but I think a better way may be needed in case other scenarios rise up.
- I've thought about doing a list and only interacting with the earliest entry.
- Also thought about using a global variable as a control variable for interactions.
Thanks.
Last edited: