extends StaticBody2D

signal Opened

@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D

var is_open := false

func OpenGate() -> void:
	if is_open:
		return
	is_open = true
	
	sprite.play("opening")
	await sprite.animation_finished
	
	collision_shape_2d.set_deferred("disabled", true)
	sprite.play("open")
	
	Opened.emit()
