ShellDetection.gd 453 B

123456789101112131415161718
  1. class_name ShellDetection
  2. extends Node
  3. @export var hitbox: Area2D = null
  4. signal moving_shell_entered(shell: Node2D)
  5. func _ready() -> void:
  6. hitbox.area_entered.connect(area_entered)
  7. func area_entered(area: Area2D) -> void:
  8. if area.owner is Shell and area.owner != owner:
  9. if abs(area.owner.velocity.x) > 0:
  10. moving_shell_entered.emit(area.owner)
  11. area.owner.add_combo()
  12. func destroy_shell(shell: Shell) -> void:
  13. shell.die_from_object(owner)