PowerUps/MultiBallEffect.cs

A power-up effect class for Breakout that spawns additional balls and triggers a short hit-stop. It exposes ExtraBalls and SpreadAngle properties and calls game.SpawnExtraBalls and game.HitStop when applied.

NetworkingFile Access
using Sandbox;

namespace Breakout;

/// <summary>
/// Pickup effect that splits extra balls off the current ball, fanned out by SpreadAngle.
/// </summary>
[Title( "Multi Ball Effect" ), Category( "Breakout" ), Icon( "scatter_plot" )]
public sealed class MultiBallEffect : PowerUpEffect
{
	[Property] public int ExtraBalls { get; set; } = 2;

	[Property] public float SpreadAngle { get; set; } = 22f;

	/// <summary>
	/// Splits extra balls off the current ball, fanned out by SpreadAngle, then adds a brief hit-stop.
	/// </summary>
	public override void Apply( BreakoutGame game, Paddle paddle )
	{
		game?.SpawnExtraBalls( ExtraBalls, SpreadAngle );
		game?.HitStop( 0.05f );
	}

	public override string Label => "MULTI-BALL";

	public override Color LabelColor => new Color( 0.36f, 0.86f, 1f );
}