nc5432 847a41eaad Animations and bug fixes
- Converted the rock throw animation to the new system
- Converted the fireball animation to the new system (needs to be inverted still)
- Spell variable now get set to null after use or they get interrupted
- Made some code more readable
2024-05-13 22:38:17 -04:00

28 lines
652 B
GDScript

extends AnimationBase
@onready var texture: TextureRect = $TextureRect
@onready var animationPlayer: AnimationPlayer = $AnimationPlayer
var failIndex: int = 0
var animQueue: Queue = Queue.new()
# Called when the node enters the scene tree for the first time.
func _ready():
if inverted:
attackName = inverseName
func castFailed() -> void:
queue_free()
func setProgress(target: float, final: float = finalProg) -> void:
targetProg = target
finalProg = final
if (index > -1):
animationPlayer.queue(attackName + str(index))
index += 1
func animFinished(s: String):
if (index == finalIndex):
animationFinished.emit(spell)
queue_free()