move ( maze-gadget move -- )


Vocabulary
gamelib.demos.maze-game

Inputs
maze-gadgetan object
movean object


Outputs
None

Definition


:: move ( maze-gadget move -- )
maze-gadget board-gadget>> board>> first :> board
maze-gadget maze-scroller>> :> scroller board
[ COLOR: blue = ] find-cell-pos
:> player-pos player-pos move v+
:> new-pos new-pos bound-check [
board new-pos can-move? [
player-pos { 0 1 } = not player-pos { 16 15 } =
not and [ scroller move move-window ] when
board player-pos new-pos move-entire-cell drop
] when
] when maze-gadget relayout-1 ;