1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 23:11:54 +08:00
Files
Dog-Lynx-And-HCN/scripts/Statemachine/DamageLabel.gd
T
fallingshrimp 9a10e87cb0 Add audio effect and implement FireScan bullet behavior
- Added Rip.wav audio effect to the project.
- Created FireScan bullet script with speed and damage properties.
- Implemented basic AI movement for FireScan bullets.
- Introduced Wave class for managing enemy waves with dynamic counts and spawning logic.
2025-08-26 17:28:20 +08:00

27 lines
757 B
GDScript

extends Node2D
class_name DamageLabel
@export var damage: float = 0
@export var crit: bool = false
@onready var label: Label = $"%label"
@onready var animator: AnimationPlayer = $"%animator"
func _ready():
if damage == 0:
label.text = "MISS"
else:
label.text = str(round(damage)) + ("!!!" if crit else "")
animator.play("show")
await animator.animation_finished
queue_free()
static func create(spawnDamage: float, spawnCrit: bool, spawnPosition: Vector2, addToWorld: bool = true) -> DamageLabel:
var instance = preload("res://components/UI/DamageLabel.tscn").instantiate()
instance.damage = spawnDamage
instance.crit = spawnCrit
instance.position = spawnPosition
if addToWorld:
WorldManager.rootNode.add_child(instance)
return instance