GAME 1303 — Tier 5: Top-Down & Grid Movement

Twelve scripts. This is the tier that unblocks the two non-platformer projects — Last Delivery (Chris) and Weenie(dog) Maze (Jax) — plus Apep's Trial's top-down sections and Cozy Critters' wandering pet.

Builds on Tier 1 (Health, Collectible/CollectionTracker, AudioManager, GameManager) and Tier 4 (ChoiceFlagManager). Nothing from earlier tiers changes.

Scripts/
  Movement/  TopDownMover, GridMover, WrapAround
  Snake/     SnakeBody, TreatSpawner
  Delivery/  DeliveryObjective, DeliveryPoint, DroppedCargo,
             LaneSpawner (+ LaneTraveller, LaneDespawner helpers)
  Maze/      MazeLoader

Two ways to move without gravity

TopDownMover — smooth 8-direction movement, the top-down counterpart to PlayerController2D. It deliberately mirrors that script's API (InputEnabled, MovementLocked, SpeedMultiplier, ResetMotion), so Tier 1's RespawnManager and anything else built against the platformer controller keeps working. Three facing modes: flip on X, four-direction animator params (MoveX/MoveY/Speed — the Zelda-style setup), or rotate the sprite (good for a delivery robot). Set aiControlled and call SetMoveInput() to drive it from a brain instead of a player.

GridMover — discrete steps snapped to a grid, in two flavors that feel completely different:

It finishes each step before starting the next (so key-mashing can't desync you from the grid) and queues one input during a step, which is what makes tight turns feel fair rather than mushy. speedUpPerStep makes the snake accelerate as it grows.

Weenie Maze (Jax) — the whole game

Head object: Sprite + trigger Collider2D + GridMover (Continuous) + SnakeBody, tagged Player.

SnakeBody works the classic way: the head records the cell it leaves each step, segment 1 moves there, segment 2 to where segment 1 was, and so on — a queue of positions rather than per-segment logic, which is both simpler and the standard trick worth showing the class. Grace Segments (default 1) is the fairness knob: the segment right behind the head can't kill you, which prevents deaths that feel like bugs on tight turns.

Wire OnSelfCollision → GameManager.GameOver, and the treat's Collectible.OnCollected → SnakeBody.Grow. TreatSpawner drops the next treat somewhere that isn't a wall, isn't under the dog, and isn't right on top of the player; when it can't find a spot, OnSpawnFailed fires — which in Snake means the board is full, i.e. the player won.

The maze itself can be typed rather than drawn: see MazeLoader below. WrapAround is there if Jax wants open edges instead of walls.

Last Delivery (Chris) — the whole loop

Robot: TopDownMover (or GridMover Stepped for a lane-based Crossy Road feel) + Health + DeliveryObjective.

The design question worth putting to Chris is what failure means. His pitch says monsters "try to intercept you to steal the food" — so DeliveryObjective treats cargo, not health, as the resource. A monster hit calls LoseOne(), which drops a DroppedCargo into the world that you can scramble to recover before it despawns. Arriving at the DeliveryPoint with nothing fires OnArrivedEmpty. That gives real tension without needing combat, which suits a delivery robot better than a health bar. He can still wire Health.OnDamaged → LoseOne if he wants both.

LaneSpawner is the Crossy Road traffic: place it at one end of a lane, give it prefabs, and it sends them across at intervals with speed variance, despawning at the far end. The recipe that makes a route into a puzzle is mixing predictable lane traffic with unpredictable Tier 2 EnemyChase monsters that actually hunt.

MazeLoader — levels as text

A maze is a block of characters you type or paste:

###########
#....T....#
#.###.###.#
#....P....#
#.###.###E#
###########

# wall, ./space empty, P player start, and any other character maps to a prefab you assign (treats, monsters, exits, doors). It builds into a Tilemap (fast, tidy) or spawns wall prefabs (simpler), centres on its own transform, and stores every marker position so other scripts can read them — GetPositions('T') gives you treat spawn points.

This matters more than it looks: iterating a maze layout in the Scene view is slow, and a text block can be edited, versioned, and even pasted from a spreadsheet in seconds. Worth demoing in class even to the platformer students.

Per-game recipes

AudioManager names referenced

cargo_lost, delivered, collect.

Notes for the instructor