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

47 lines
1.4 KiB
GDScript

extends "res://Scripts/animationBase.gd"
@export var startPrimaryLoc: Vector2
@export var startSecondaryLoc: Vector2
@export var fullSize: float = 1
@export var explodeDur: float = 0.2
@onready var ballofayr: AnimatedSprite2D = $Path2D/PathFollow2D/AnimatedSprite2D
@onready var path: PathFollow2D = $Path2D/PathFollow2D
@onready var particles: GPUParticles2D = $Path2D/PathFollow2D/GPUParticles2D
var dir: int = 1
var exploding: bool = false
var timer: float = 0
var size: Vector2 = Vector2(0, 0)
# Called when the node enters the scene tree for the first time.
func _ready():
if inverted:
dir = -1
ballofayr.position = startSecondaryLoc
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if !exploding:
if (targetProg / finalProg < 0.3):
timer = clampf(timer + delta, 0, clampf(targetProg / finalProg, 0, 0.25))
path.progress_ratio = timer
if (targetProg / finalProg < 0.9):
ballofayr.scale = lerp(ballofayr.scale, Vector2((targetProg / finalProg) * fullSize, (targetProg / finalProg) * fullSize), delta * 2)
if (targetProg / finalProg >= 0.9):
timer = clampf(timer + delta, 0, targetProg / finalProg)
path.progress_ratio = timer
if path.progress_ratio == 1:
explode()
else:
timer += delta
if timer > explodeDur:
self.free()
func explode():
ballofayr.hide()
particles.emitting = true
exploding = true
timer = 0
func castFailed():
explode()