BombExplosion.gd 497 B

1234567891011121314151617181920212223242526272829
  1. extends Area3D
  2. func _ready() -> void:
  3. $AudioStreamPlayer3D.pitch_scale = randf_range(0.86, 0.93)
  4. $AudioStreamPlayer3D.play()
  5. func _on_Timer_timeout() -> void:
  6. call_deferred("queue_free")
  7. func _on_Explosion_body_entered(body: Node3D) -> void:
  8. if body.is_in_group("movable") and body.has_node("Health"):
  9. if body.invincible == true:
  10. return
  11. if body.has_method("explode"):
  12. body.explode()
  13. elif body.has_method("hit"):
  14. body.hit()
  15. body.health_node.kill()