ExplosionDetection.gd 318 B

12345678910111213
  1. class_name ExplosionDetection
  2. extends Node
  3. @export var hitbox: Area2D = null
  4. signal explosion_entered(explosion: Node2D)
  5. func _ready() -> void:
  6. if hitbox != null:
  7. hitbox.area_entered.connect(area_entered)
  8. func area_entered(area: Area2D) -> void:
  9. if area.owner is Explosion:
  10. explosion_entered.emit(area.owner)