Menu

Undo, Rotate and Falling Blocks: Giving Players Control in a Puzzle Game
📰

Undo, Rotate and Falling Blocks: Giving Players Control in a Puzzle Game

DEV Community: javascript·Instant Games·13 days ago
#UokOcEmq
#devtojavascript#devto#dev#puzzle#block
Long article (572 words) — no AI summary yet.
Reading 0:00
15s threshold

A classic block puzzle is simple: three pieces, a 10x10 board, no clock. Simple games are hard to balance, because there are so few knobs. In Instant Block Puzzle I used three of them: undo, rotation and an optional Falling Blocks mode. This post is about what each one does to the feel of the game.

Undo: forgiveness as a feature

You get 3 undos per game. That number is a decision.

Zero undos makes every misdrag fatal. On a touchscreen, where fingers slip, that is frustrating for the wrong reasons.

Unlimited undos removes consequences and weakens the puzzle.

A small, fixed number forgives accidents while keeping decisions meaningful.

Implementation-wise, undo is a stack of snapshots. Because the board is just 100 cells plus the current pieces and score, copying the whole state per move is cheap and far safer than trying to reverse operations.

// simplified sketch const history = [ ] ;

function commitMove ( state ) { history .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.