I'm having troubles with interacting with doors in my game, if there are multiple on one map and I open one, I cannot open any others until the one I opened has closed. They all use their own animation player, before anybody asks.
I have a temporary fix where the door closes itself after 2 seconds, but I obviously can't finish my game with this.
Here's the code below:
extends Spatial
export(NodePath) var animationPlayer
onready var animation = get_node(animationPlayer)
export var open = false
const COOLER = 2
onready var timer = COOLER
func _ready():
if open:
animation.play("Appen")
set_process(true)
func _process(delta):
if open:
if timer <= 0:
animation.play("Close")
open = false
timer = COOLER
else:
timer -= delta
func activate(presser):
if open:
animation.play("Close")
open = false
else:
animation.play("Open")
open = true
After printing the open boolean of all the doors, I found that it's setting all of the open values to true... I made open a private variable, but the problem persists.
I'm at a loss, how do I fix it?