class_name PowerUp extends RigidBody2D ## A small dot that falls from the top. Catch it with the paddle to collect it. signal collected(power_up: PowerUp) enum Kind { SAVE, TRIPLE_BALLS, PADDLE, SUPERBALL } const RADIUS := 5.0 const COLORS := { Kind.SAVE: Params.COLOR_GREEN, Kind.TRIPLE_BALLS: Params.COLOR_PINK, Kind.PADDLE: Params.COLOR_BLUE, Kind.SUPERBALL: Params.COLOR_ORANGE, } var kind := Kind.SAVE func _ready() -> void: add_to_group("power_ups") body_entered.connect(_on_body_entered) func _on_body_entered(body: Node) -> void: if body is Paddle: collected.emit(self) queue_free() elif body.is_in_group("bottom"): queue_free() func _draw() -> void: draw_circle(Vector2.ZERO, RADIUS, COLORS[kind], true, -1.0, true)