← Back to games
Snake 2D
Arcade snake with local 2-player duels, driven by subclassed input and coroutine spawning
Unity 2021.3 LTSC#InheritanceSingletonCoroutinesLocal Multiplayer

A rebuilt take on the arcade classic — play solo, or head-to-head with a friend on one keyboard. The snake never stops moving and accelerates as it grows, so every pickup raises the stakes.
Tech stack
Unity 2021.3 LTS · C# · 2D trigger colliders · uGUI (score, timer, pause and game-over screens) · Coroutines
Architecture & design patterns
- Template Method via inheritance —
Player1andPlayer2both extendPlayerControllerand override a singlePlayerInput()hook, so grid movement, growth and collision handling are written once and only the key bindings differ (arrows vs WASD) - Singleton with cross-scene persistence —
SoundManagerguards a staticInstanceand callsDontDestroyOnLoad, exposing an enum-to-AudioCliptable so music and effects survive scene changes - Coroutine-based spawning —
SpawnFood(prefab, delay)schedules apples, skulls and power-ups on randomised timers at random points inside aBoxCollider2Dplay boundary - Enum-typed power-ups —
PowerUpType { Egg, Potion, Meat }selects the effect applied to the player, including a shield flag that changes collision outcomes - List-backed body model — the snake body is a
List<GameObject>of segments appended on eat and trimmed on damage, with each segment stepping toward the previous one's target position
Versus rules are resolved through trigger collisions: bite another player and they're out, while a head-on crash eliminates whoever has the lower score. Built while training with the Outscal community.