Commit graph

5 commits

Author SHA1 Message Date
enzotar
d4f353394f fix: keyboard inputs now respect collision — soft drop and hard drop gated on blocked
ArrowDown soft drop, Space hard drop, and Drop button all bypassed
the blocked signal, letting pieces pass through frozen blocks.
Now all three gate on blocked before modifying py.
2026-02-27 12:44:19 -08:00
enzotar
b8fb60d8c4 fix: collision off-by-one — pieces now stack adjacently
Collision was checking grid[py+2] instead of grid[py+1].
Pieces stopped one row too early, creating gaps.
Now checks grid[py+1] (where top cells would land) with full
3-column width (px, px+1, px+2).
Pieces now stack directly on top of each other.
2026-02-27 12:29:42 -08:00
enzotar
df8b74bab3 feat: live signal debug panel for tetris
Replaced static signal key with live debug panel showing:
- Piece state: piece, px, py, rotation, blocked, lockTick
- Physics: score, lines, level, gravityTick, dropInterval
- Grid rows: g13-g19 with full array contents

Blocks confirmed persisting correctly after collision.
2026-02-27 12:26:01 -08:00
enzotar
d9e0e31d1b fix: tetris collision detection — pieces now stack properly
Added 'blocked' signal that checks frozen grid cells below active piece.
Collision check branches on py to inspect the correct grid row (13-19).
Gravity only drops when not blocked. Lock triggers on blocked state.
Freeze writes piece into correct row based on py (7 rows supported).
Added grid rendering for rows 13-15 (total 7 visible frozen rows).
Build output: 84KB
2026-02-27 12:20:09 -08:00
enzotar
075c4a20fe feat: tetris — signal composition showcase with 6 reactive layers
game-tetris.ds demonstrates DreamStack signal composition:
- Layer 1: Data signals (20 grid rows, piece state, next piece)
- Layer 2: Physics signals (gravity tick, drop speed, level scaling)
- Layer 3: Input signals (keyboard events -> movement commands)
- Layer 4: Derived signals (lock detection, line clear, game over)
- Layer 5: Sound signals (lock, clear, game over tones)
- Layer 6: Stream signals (30+ signals broadcast for spectators)

Board: 10x20 grid, 7 piece types, ghost piece indicator
Controls: Arrow keys, space (hard drop), P (pause)
Side panel: next piece preview, stats, signal layer key
Compiles to 76KB HTML+JS
2026-02-27 12:13:22 -08:00