1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-15 16:12:30 +08:00

加了后坐力然后优化了能量显示的逻辑,司马trae

This commit is contained in:
2025-08-28 21:57:04 +08:00
parent 77e6711358
commit 9015d2b723
7 changed files with 11 additions and 15 deletions
+2
View File
@@ -15,6 +15,7 @@ class_name BulletBase
@export var autoLoopAnimation: bool = false
@export var freeAfterSpawn: bool = false
@export var knockback: float = 0 # 击退力,物理引擎单位
@export var recoil: float = 0 # 后坐力,物理引擎单位
@onready var animator: AnimationPlayer = $"%animator"
@onready var hitbox: CollisionShape2D = $"%hitbox"
@@ -46,6 +47,7 @@ func _process(_delta: float) -> void:
destroy()
func _physics_process(_delta: float) -> void:
if is_instance_valid(launcher) and (launcher.isPlayer() or is_instance_valid(launcher.currentFocusedBoss)):
launcher.position -= Vector2.from_angle(rotation) * recoil
ai()
func hit(target: Node):
+1 -1
View File
@@ -83,7 +83,7 @@ func _ready():
currentFocusedBoss = get_tree().get_nodes_in_group("players")[0]
applyLevel()
health = fields.get(FieldStore.Entity.MAX_HEALTH)
energy = fields.get(FieldStore.Entity.MAX_ENERGY) * 0.5
energy = fields.get(FieldStore.Entity.MAX_ENERGY)
healthChanged.connect(
func(newHealth):
if is_instance_valid(statebar):
+1 -1
View File
@@ -26,7 +26,7 @@ func _process(_delta):
bossbar.visible = !!bossbar.entity
func _physics_process(_delta):
if is_instance_valid(player):
energyLabel.text = "%.2f" % player.energy
energyLabel.text = "%.2f" % clamp(player.energy, 0, player.fields.get(FieldStore.Entity.MAX_ENERGY))
energyMaxLabel.text = "%.1f" % player.fields.get(FieldStore.Entity.MAX_ENERGY)
for i in items.get_children():
var item = i as ItemShow