func _on_shop_pressed() -> void:
if not is_shop_visible:
_shop_instance = shopin.instantiate()
get_tree().get_root().add_child(_shop_instance)
_animation_player = _shop_instance.get_node("AnimationPlayer")
_animation_player.play("SlideIn")
is_shop_visible = true
else:
_animation_player = _shop_instance.get_node("AnimationPlayer")
_animation_player.play("shopout")
is_shop_visible = false
yield(_animation_player, "animation_finished")
get_tree().get_root().remove_child(_shop_instance)
$store.play()
func _on_shop_pressed() -> void:
if not is_shop_visible:
_shop_instance = shopin.instantiate()
get_tree().get_root().add_child(_shop_instance)
_animation_player = _shop_instance.get_node("AnimationPlayer")
_animation_player.play("SlideIn")
is_shop_visible = true
else:
_animation_player.stop() # Stop the first animation
get_tree().get_root().remove_child(_shop_instance)
_shop_instance = shopout.instantiate()
get_tree().get_root().add_child(_shop_instance)
_animation_player = _shop_instance.get_node("AnimationPlayer")
_animation_player.play("shopout")
is_shop_visible = false
$store.play()