60 lines
1.6 KiB
GDScript3
Raw Normal View History

extends "res://Scripts/animationBase.gd"
@onready var texture: TextureRect = $TextureRect
@onready var animationPlayer: AnimationPlayer = $AnimationPlayer
var failIndex: int = 0
var animQueue: Queue = Queue.new()
2024-05-03 19:45:30 -04:00
# Called when the node enters the scene tree for the first time.
func _ready():
if inverted:
pass
#texture.position.x = (-(texture.position.x - 571)) + 571
#for point: Vector2 in path:
#point.x = (-(point.x - 571)) + 571
#for point: Vector2 in failPath:
#point.x = (-(point.x - 571)) + 571
#if !inverted:
#pass
#path = $Path2D/PathFollow2D
#failPath = $Path2D/PathFollow2D/Path2D/PathFollow2D
#else:
#pass
#path = $Path2D/PathFollow2D
#failPath = $Path2D/PathFollow2D/Path2D/PathFollow2D
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
#if casting:
#if targetProg / finalProg < 0.7:
#timer = clampf(timer + delta, 0, clampf(targetProg / finalProg, 0, 0.35))
#path.progress_ratio = timer
#else:
#timer = clampf(timer + delta, 0, 1)
#path.progress_ratio = timer
#if path.progress_ratio == 1:
#self.free()
#else:
#timer = clampf(timer + (1.25 * delta), 0, 1)
#failPath.progress_ratio = timer
#if failPath.progress_ratio == 1:
#self.free()
2024-05-03 19:45:30 -04:00
func castFailed() -> void:
queue_free()
#casting = false
#timer = 0
#texture.get_parent().remove_child(texture)
#failPath.add_child(texture)
func setProgress(target: float, final: float = finalProg) -> void:
targetProg = target
finalProg = final
animQueue.push("attackSegment" + str(target))
func animFinished(_animName):
if (animQueue.size() > 0):
animationPlayer.play(animQueue.pop())