DYSTOPIANPIXEL
PHASELOCK / NEXTBASIC / DYSTOPIAN PIXEL

Stage 7 — Add permanent walls and map collision

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.11 / PHASELOCK_STAGE_V011_FINAL.zip.

The logical grid introduced in v0.10 becomes a genuine collision map in this stage. The important change is not the temporary wall artwork; it is that levelMap now owns a permanent gameplay rule.

Give levelMap meaningful tile IDs

Stage 7 establishes the first two map values:

LET tileFloor=0
LET tileWall=1

A value of 0 means ordinary traversable floor. A value of 1 means a permanent wall that MILO may never enter.

Keep the visible test wall and collision map together

The development helper addWall() updates levelMap and places the temporary wall sprite at the same tile coordinate. This prevents the visual test wall and the collision data from silently disagreeing.

LET levelMap(wallTileX,wallTileY)=tileWall
SPRITE wallSprite,wallTileX*tileSize,wallTileY*tileSize,wallPattern,1,0,0,0

Reject the destination before animation

attemptMove() still calculates the requested destination first. It now checks the 20×16 boundary and then reads levelMap(targetTileX,targetTileY). A wall changes moveAllowed to 0 before animateMove() can run.

This preserves the architectural rule established in Stage 6: the grid decides whether a movement is legal; the sprite animation only carries out an already-approved move.

Stage 7 movement contract

  • A wall collision produces no lean animation.
  • MILO does not travel into the wall.
  • playerTileX/playerTileY do not change.
  • x/y do not change.
  • Later systems must also treat the move as unsuccessful: it must not change phase, score a tile or advance an enemy turn.

Acceptance and baseline

v0.11 is now the completed Stage 7 reference build and the project may proceed to Blue/Amber phase-floor behaviour. Pattern 16 remains temporary development artwork rather than the final wall graphic.