| 12345678910111213141516171819202122232425262728 |
- 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:
- # Inset like the blocks, so the gap to the first ring matches the gap between tiles.
- draw_circle(Vector2.ZERO, radius - Block.GAP / 2.0, Params.COLOR_RED, true, -1.0, true)
|