Supernova
Gameplay Programmer — Unity 6 (URP), C#
Status: Work in Progress
Overview
Supernova is a 2D space arcade game built in Unity 6 (URP) where players control a growing star navigating asteroid fields. The core loop centers on absorbing smaller objects to grow through stages while managing an instability meter—grow too fast or reach critical mass and the star explodes. Players can trigger a manual supernova at the optimal moment for bonus points, or risk an automatic explosion if instability reaches 100%.
This project showcases stage-based progression, time-windowed absorption tracking, component-based collision behavior, and state-driven game architecture.
Focus of the Project
State-driven game architecture using a singleton
GameManagerand enum-based states (Menu / Playing / Paused / GameOver)Stage progression system driven by size thresholds, with stage-specific behaviors (color, zoom, baseline instability, shrink rates)
Instability mechanics combining per-stage baseline values with a rolling 1-second absorption rate penalty
Component-based collision tagging (
Absorbable,Neutral,InstantKill) to define behavior without deep inheritanceDevelopment tooling including an editor window for batch-updating asteroid sizes and runtime collider visualization toolsMake it stand out
How It Works
You begin as a small star (Stage 0) with directional movement (WASD/arrow keys).
Absorbing smaller asteroids increases star size and score.
Colliding with larger objects causes shrinkage and score penalty.
You progress through 6 stages (0–5) as your size increases (visual color change: White → Red → Blue).
Instability rises from a stage baseline + a penalty when you absorb too rapidly (tracked over the last 1 second).
The camera zooms out as you reach higher stages to keep gameplay readable.
Environment staging is managed so only the current and previous stages remain active for performance.
At Stage 3+, you can trigger a manual supernova (SPACEBAR) for a +300 score bonus.
If instability hits 100%, you supernova automatically without the bonus, ending the run.
Core Systems Implemented
Player Movement & Input
What it does: Simple directional movement using Unity’s legacy input axes.
Implementation: PlayerMovement1.cs (PlayerMovement1)
Uses
Input.GetAxis("Horizontal"/"Vertical")Applies movement via
transform.Translate()inUpdate()Movement is scaled by
Time.deltaTime
Key tunable field:speed(float)
Game State Management
What it does: Central singleton that controls game states, scene transitions, pause/time scaling, and an optional timer.
Implementation: GameManager.cs (GameManager, enum GameState)
Singleton pattern with
DontDestroyOnLoadUses
SceneManager.sceneLoadedto handle scene-aware transitionsPause toggling (debug hotkey: P)
GameOver()setsTime.timeScale = 0f(note: may affect UI responsiveness depending on setup)
Key tunable fields:useTimerSystem(bool)gameTimeLimit,maxTimeLimit(float)useCheckpointSystemexists as a toggle but is not implemented
Camera Follow & Stage-Based Zoom
What it does: Smooth vertical follow + stage-driven zoom scaling.
Implementation:
CameraFollow.cs(CameraFollow) — follow logicPlayerStarCore.cs—CameraZoom()method controls zoom targets
Follow fields:player,smoothSpeed,yOffset
Zoom behavior: Hard-coded targets per stage:Stage 0: 20
Stage 1: 35
Stage 2: 61
Stage 3: 107
Stage 4: 187
Zoom transitions viaMathf.Lerp().
Procedural Level Streaming (Action Blocks)
What it does: Spawns/destroys modular “action block” segments as the player moves upward, keeping a fixed number active.
Implementation: LevelGenerator.cs (LevelGenerator)
Spawns initial blocks (
initialBlockCount)Spawns a new block each time player travels
distanceBetweenBlocksupwardDestroys the oldest if over
maxActiveBlocksPrevents consecutive duplicate block selections
Prefab requirement: Each block must have a child transform named "SpawnPoint" for chaining.
Collision / Absorption Logic (Component Tags)
What it does: Collision behavior is driven by tag components rather than deep inheritance.
Implementation:
PlayerStarCore.cs—OnTriggerEnter2D()Tag components:
Absorbable.cs,Neutral.cs,InstantKill.cs
Behavior flow (simplified):Neutral→ ignore collisionInstantKill→ force instability to 100+Absorbable→ absorb if size threshold passes ORignoreThreshold = truegrow by
massValue(or fallback growth)add score
record absorption timestamp for instability tracking
destroy object
Too large (or no tag) → shrink + score penalty
Key fields:absorbableThreshold,fixedGrowthAmount,scorePerAbsorptionAbsorbable.massValue,ignoreThreshold
Instability System (Stage Baseline + Rolling Window Penalty)
What it does: Instability is driven by two factors:
stage baseline, and
absorption rate in the last 1 second
Implementation:PlayerStarCore.cs
UpdateInstability(),RecordAbsorption(),GetRecentAbsorptionRate(),CheckForSupernova()
Key tunable fields:baseInstabilityPerStage={0, 15, 30, 45, 60, 75}absorptionWindow=1fabsorptionRateMultiplierinstabilityDecayRate(moves toward target usingMathf.MoveTowards)
Rules:rapid absorption → temporary spike
stop absorbing → penalty drops after 1 second
higher stage → higher baseline
100% instability → automatic supernova (no bonus)
godModeforces instability to 0 and disables supernova behavior
Stage Progression & Scaling
What it does: Stage is determined by size thresholds and drives multiple systems: shrink rate, color, zoom, baseline instability, environment activation.
Implementation:
PlayerStarCore.cs—UpdateCurrentStage(),ColorChange()StageCoordinator.cs— activates/deactivates stage containers
Key thresholds:stageRanges={2, 4, 10, 18, 28, 40}
Shrink values:shrinkagePerStage={0.3, 0.4, 0.5, 0.6, 0.7}
StageCoordinator behavior: keeps current + previous stages active.
UI / HUD
What it does: Real-time updates for score, stage display, instability slider, pause menu, and game over menu.
Implementation:
PlayerStarCore.cs(score, stage, instability)PauseMenu.cs,GameOverMenu.csButton scripts:
RetryButton.cs,ResumeGameButton.cs,ReturnToMainMenuButton.cs,StartGameButton.cs
Note: menu panels currently poll state inUpdate()(not event-driven).
Debug Tools & Editor Utilities
Editor Tool: AsteroidSizeUpdater.cs
Batch updates asteroid prefab scales across stages via an EditorWindow
Visualization Tools:ColliderSizeViewer.cs([ExecuteInEditMode]) shows real-time collider size calculationsColliderVisualizer.cs([ExecuteAlways]) draws collider outlines for multiple collider types
Debug hotkeys:1shrink,2growSpacemanual supernova (Stage 3+)Ppause toggle (GameManager)
Code Samples
PlayerStarCore.cs — Stage progression, absorption logic, time-windowed instability calculation
GameManager.cs — Singleton state machine + scene-aware transitions
Absorbable.cs — Tag component that defines absorption behavior
StageCoordinator.cs — Stage container activation/deactivation strategy
PlayerMovement.cs — Simple directional movement using Unity input axes with frame-rate independent movement
Note for readers: scripts are shown as representative samples; some reference Unity UI components and project-specific prefabs/components (Absorbable, Neutral, InstantKill, etc.).