nc543 4bf910f4ea Added a lose condition
- Added a win/lose condition
- Added a finish state indicator. Transition currently does not work.
- Fixed enemy animation durations for icy wind spell
2024-05-25 23:51:28 -04:00

27 lines
694 B
GDScript

class_name SpellSlot extends TextureRect
@onready var overlay: ColorRect = $Overlay
@onready var particles: GPUParticles2D = $GPUParticles2D
@onready var data: Data = $/root/Root/Data
@export var spell: Spell
var timer: float = 0
var canCast: bool = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if (spell == null || !data.playing): return
timer = clampf(timer - delta, 0, spell.cooldown)
if (!canCast && timer == 0):
canCast = true
particles.emitting = true
overlay.scale.y = timer / spell.cooldown
func setSpell(spel: Spell):
spell = spel
texture = spel.icon
func spellCast(down: float):
timer = down
canCast = false