extends Sprite

var is_player_inside: bool = false
var is_opened: bool = false
var has_gem: bool = true

signal gem_collected

# Declare member variables here. Examples:
# var a: int = 2
# var b: String = "text"


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
    pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
#	pass


func _on_Player_Detector_area_entered(area: Area2D) -> void:
    if area.get_parent().name == 'Player':
        if is_opened == false:
            $chestClosed.visible = false
            $chestOpened.visible = true
            $Gem.visible = true
            $Gem/AnimationPlayer.play('rise')
            is_opened = true
            has_gem = false
            emit_signal('gem_collected')
