DYSTOPIANPIXEL
PHASELOCK / NEXTBASIC / DYSTOPIAN PIXEL

Stage 5 — Add lean, travel and recovery animation

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.

The first animation attempts changed patterns while the robot was already travelling. On hardware this did not communicate the intended physical action clearly enough. The stronger version separates the movement into three visible phases.

Lean while stationary → travel one tile at maximum lean → recover while stationary at the destination.

Animation sequence

For a Right move, for example, the robot uses pattern 4 upright, then 5, 6 and 7 while stationary. It then travels all 16 pixels holding pattern 7. At the destination it reverses through 6, 5 and 4. The same pattern arithmetic works for all four directions because each direction occupies a consecutive block of four patterns.

PhasePattern expressionPosition
StartpStartCurrent tile
LeanpStart+1 → pStart+3Stationary
TravelpStart+3Moves 16 pixels
RecoverpStart+2 → pStartStationary at destination

v0.10 animateMove procedure (movement behaviour introduced in v0.9)

7000 DEFPROC animateMove(dx,dy,pStart)
7010 LOCAL i
7020 LOCAL p
7030 LOCAL d
7040 SPRITE STOP
7050 SPRITE 0,x,y,pStart,1,0,0,0
7060 SPRITE MOVE INT
7070 FOR p=pStart+1 TO pStart+3
7080 SPRITE 0,x,y,p,1,0,0,0
7090 FOR d=1 TO poseDelay
7100 SPRITE MOVE INT
7110 NEXT d
7120 NEXT p
7130 FOR i=1 TO tileSize
7140 LET x=x+dx
7150 LET y=y+dy
7160 SPRITE 0,x,y,pStart+3,1,0,0,0
7170 FOR d=1 TO moveDelay
7180 SPRITE MOVE INT
7190 NEXT d
7200 NEXT i
7210 FOR p=pStart+2 TO pStart STEP -1
7220 SPRITE 0,x,y,p,1,0,0,0
7230 FOR d=1 TO poseDelay
7240 SPRITE MOVE INT
7250 NEXT d
7260 NEXT p
7270 SPRITE RUN
7280 ENDPROC

Why SPRITE STOP / SPRITE MOVE INT / SPRITE RUN are used

The routine batches visible sprite-attribute changes around display interrupts. SPRITE STOP prevents automatic updates while the program prepares the next pose or coordinate. SPRITE MOVE INT applies the pending attributes at an interrupt, providing controlled visible steps. SPRITE RUN restores normal sprite processing when the complete tile move is finished.

moveDelay and poseDelay are deliberately separate. moveDelay controls how long each one-pixel travel step is held; poseDelay controls how long each lean or recovery pose is held. Keeping them independent lets the physical travel and character animation be tuned separately on real hardware.

Real-hardware result

This version was accepted as clearly better than the earlier movement cycle. The robot now visibly commits into the move before travelling and settles after arrival, which suits a one-wheeled character much better than a looping walk animation.