
- Implemented more animations - Added spell HUD - Fixed interrupted spell cooldowns - Fixed getting stunned when all damage is blocked - Added export presets
26 lines
634 B
GDScript
26 lines
634 B
GDScript
class_name SpellSlot extends TextureRect
|
|
|
|
@onready var overlay: ColorRect = $Overlay
|
|
@onready var particles: GPUParticles2D = $GPUParticles2D
|
|
|
|
@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): 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
|