DYSTOPIANPIXEL
PHASELOCK / NEXTBASIC / DYSTOPIAN PIXEL

Stage 8 — Add Blue/Amber phase tiles

Build a top-down phase puzzle game, one hardware-tested development stage at a time.

MILO in the Blue and Amber Phase Grid
Concept artwork · PHASELOCK development tutorial through v0.13.

Definitive reference build: PHASELOCK v0.12 / PHASELOCK_STAGE_V012_FINAL.zip.

Stage 8 turns the Blue/Amber Phase Grid from a design rule into working gameplay. The logical map now distinguishes neutral floor, permanent walls, Blue floor and Amber floor, while the game tracks one global phase shared by the level.

Extend the tile map without changing its ownership

LET tileFloor=0
LET tileWall=1
LET tileBlue=2
LET tileAmber=3

levelMap remains authoritative for what occupies a logical tile. The new values extend the map instead of creating a separate collision system.

Predict the phase produced by the move

LOCKSTEP changes phase only when a voluntary movement succeeds. Because a phase-floor destination may be legal in one state and illegal in the other, the program calculates the phase that would exist after a successful move before deciding whether that destination can be entered.

LET nextPhase=1-currentPhase

From Blue, the next successful move produces Amber. An Amber destination may therefore be entered; a Blue destination is rejected. From Amber the relationship reverses.

Rejected movement never consumes a phase change

The Stage 6 and Stage 7 architecture remains intact: attemptMove() approves the destination first, animateMove() only performs an approved move, and currentPhase is updated only after that legal movement completes.

A phase-blocked move therefore causes no lean animation, no travel, no logical-position update and no phase change.

Show active and inactive test floors

The v0.12 asset set adds temporary Blue-active, Blue-inactive, Amber-active and Amber-inactive patterns. refreshPhaseTiles() redraws the development floor sprites after every successful phase change so the current Grid state is visible while testing. These patterns are diagnostic artwork, not the final PHASELOCK floor design.

Real-hardware acceptance

The completed v0.12 build passed the following tests on a real ZX Spectrum Next:

  • From (9,7), Q towards Blue (9,6) was blocked as expected and the Grid remained Blue.
  • From (9,7), P towards Amber (10,7) succeeded and the Grid became Amber.
  • From (10,7), P towards Blue (11,7) succeeded and the Grid became Blue.
  • From (11,7), P towards Amber (12,7) succeeded and the Grid became Amber.
  • The permanent wall at (8,7) still blocked movement without changing the phase, confirming that Stage 7 did not regress.

What Stage 8 deliberately does not do

Phase Hold is not implemented in v0.12. This stage intentionally proves only the core LOCKSTEP phase transition and phase-floor legality rules. Scoring, timers, enemies and other systems remain separate later stages.