feat: 添加Hitbox和Hurtbox,添加敌人和玩家之间的碰撞
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user