error while watching old tutorial
i was watching a tutorial by GDquest on hitboxes and ik its outdated but i dont know why connect("area_entered", self, "_on_area_entered")
isn't working
class_name MyHurtBox
extends Area2D
func _init() -> void:
collision_layer = 0
collision_mask = 2
func _ready() -> void:
connect("area_entered", self, "_on_area_entered")
func _on_area_entered(hitbox: MyHitBox) -> void:
if hitbox == null:
return
if owner.has_method("take_damage"):
owner.take_damage(hitbox.damage)