nc5432 940fed1170 Background and UI
- Got new backgrounds
- Added health bars
- Added in enemy wizard using the wizard spellbook rather than the old spellbook
- Made the cast indicator smaller since it seemed a bit large
- Started working on enemy AI systems
- Fixed rock throw animation
2024-05-07 21:43:09 -04:00

37 lines
1.0 KiB
GDScript

extends "res://Scripts/animationBase.gd"
var path: PathFollow2D
var failPath: PathFollow2D
var casting: bool = true
var timer: float = 0
@onready var texture: TextureRect = $Path2D/PathFollow2D/TextureRect
# Called when the node enters the scene tree for the first time.
func _ready():
if !inverted:
path = $Path2D/PathFollow2D
failPath = $Path2D/PathFollow2D/Path2D/PathFollow2D
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
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()
func castFailed():
casting = false
texture.get_parent().remove_child(texture)
failPath.add_child(texture)
timer = 0