mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-03 01:41:53 +08:00
feat: 重构角色和子弹系统,添加伤害标签和Boss状态条
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
extends Node2D
|
||||
class_name DamageLabel
|
||||
|
||||
@export var damage: float = 0
|
||||
@export var crit: bool = false
|
||||
func _ready():
|
||||
$"%label".text = str(round(damage)) + ("!!!" if crit else "")
|
||||
$"%animator".play("show")
|
||||
await $"%animator".animation_finished
|
||||
|
||||
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:
|
||||
WorldTool.rootNode.add_child(instance)
|
||||
return instance
|
||||
Reference in New Issue
Block a user