| 123456789101112131415161718192021222324252627 |
- class_name Core
- extends StaticBody2D
- ## The red core. Hitting it in the game scene wins the level.
- @export var radius := Params.CORE_RADIUS
- func _ready() -> void:
- collision_layer = Params.LAYER_BLOCKS
- collision_mask = 0
- var shape := CircleShape2D.new()
- shape.radius = radius
- var collision := CollisionShape2D.new()
- collision.shape = shape
- add_child(collision)
- ## Grows to fill the screen; returns when the animation ends.
- func explode() -> void:
- collision_layer = 0
- var tween := create_tween()
- tween.tween_property(self, "scale", scale * 20.0, 1.0)
- await tween.finished
- func _draw() -> void:
- draw_circle(Vector2.ZERO, radius, Params.COLOR_RED, true, -1.0, true)
|