From faf00f1af058cb9e709111d4cae1f9bbe2e5a033 Mon Sep 17 00:00:00 2001 From: techrunner Date: Tue, 3 Sep 2024 15:27:23 -0500 Subject: [PATCH] Fixed bug with night stand where you could spam the interact button to bug the animation playing --- Assets/scripts/night_stand.gd | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Assets/scripts/night_stand.gd b/Assets/scripts/night_stand.gd index 0e7d033..560120c 100644 --- a/Assets/scripts/night_stand.gd +++ b/Assets/scripts/night_stand.gd @@ -1,13 +1,13 @@ -extends StaticBody3D +extends Interactable -@export var promt_message:String = "press e" -@export var promt_key:String var is_open = false +@onready var APlayer = $AnimationPlayer + func interact(player): - if not is_open: - $AnimationPlayer.play("Open") + if not is_open and not APlayer.is_playing(): + APlayer.play("Open") is_open = true - else: - $AnimationPlayer.play("Close") + elif not APlayer.is_playing(): + APlayer.play("Close") is_open = false \ No newline at end of file