Files
fps_project_1/scripts/switch_door.gd
2024-11-19 09:29:27 -06:00

25 lines
463 B
GDScript

extends Node
@export var anim_player : Node
@export var door_open_start : bool = false
var door_open : bool
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
add_to_group("door")
#check initial door state
door_open = door_open_start
#match initial door state
if door_open:
open()
else:
close()
func open():
door_open = true
anim_player.play("open")
func close():
door_open = false
anim_player.play("close")