1
0

blast.gd 667 B

123456789101112131415161718192021222324
  1. extends Node2D
  2. ## An expanding ring that fades out, drawn where something exploded.
  3. const SECONDS := 0.3
  4. var radius := 80.0
  5. var _progress := 0.0:
  6. set(value):
  7. _progress = value
  8. queue_redraw()
  9. func _ready() -> void:
  10. var tween := create_tween()
  11. tween.tween_property(self, "_progress", 1.0, SECONDS).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CUBIC)
  12. tween.tween_callback(queue_free)
  13. func _draw() -> void:
  14. var color := Params.COLOR_ORANGE
  15. color.a = 1.0 - _progress
  16. draw_circle(Vector2.ZERO, radius * _progress, color, false, 6.0 * (1.0 - _progress) + 1.0, true)
  17. color.a *= 0.25
  18. draw_circle(Vector2.ZERO, radius * _progress, color, true, -1.0, true)