extends Node2D


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


# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.
func _process(delta):
	pass
	#if %AnimatedSprite2D.animation.contains("walk"):
		#%AnimatedSprite2D.material.get_shader_parameter("tex_frg_6").pause=false
	#else:
		#%AnimatedSprite2D.material.get_shader_parameter("tex_frg_6").pause=true
	#
	
@export var facing = "S"

func play_animation(anim, seek):
	%AnimatedSprite2D.play(anim + "_" + facing)
	%AnimatedSprite2D.frame = seek
func play_animation_raw(anim):
	%AnimatedSprite2D.play(anim)
	
func play_animation_maintain(anim):
	
	var i = %AnimatedSprite2D.frame
	
	if anim + "_" + facing != %AnimatedSprite2D.animation:
		#print (anim, i)
		%AnimatedSprite2D.stop()
		%AnimatedSprite2D.play(anim + "_" + facing)
		%AnimatedSprite2D.frame = i
	elif !%AnimatedSprite2D.is_playing():
		%AnimatedSprite2D.play(anim + "_" + facing)
		%AnimatedSprite2D.frame = 0

func stop_animation():
	%AnimatedSprite2D.frame = 0
	%AnimatedSprite2D.stop()
