feat: 添加Hitbox和Hurtbox,添加敌人和玩家之间的碰撞

This commit is contained in:
luke358
2026-05-18 14:55:43 +08:00
parent 67ea3f2d42
commit 2060719f4e
10 changed files with 117 additions and 3 deletions
+19
View File
@@ -0,0 +1,19 @@
extends Area2D
class_name HurtboxComponent
signal on_damaged(hitbox: HitboxComponent)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_area_entered(area: Area2D) -> void:
if area is HitboxComponent:
on_damaged.emit(area)