Commit graph

8 commits

Author SHA1 Message Date
enzotar
5e382ce25d feat: full grid collision, freeze, and T-piece support (20 rows)
Extended collision detection from py 12-17 to py 0-17 (full grid).
Extended freeze writes from rows 13-19 to all 20 rows (0-19).
Extended T-piece bottom cell freeze from 6 rows to all 19 rows.
Pieces now correctly collide at ANY height in the grid.
Previously pieces fell through tall stacks because collision
only checked rows 12-17.
2026-02-27 13:02:06 -08:00
enzotar
5c8b397d7b fix: piece-type aware collision — only T-piece checks bottom cell
grid[py+2] at px+1 now only checked when piece==6 (T-piece).
Other pieces (I, J, L, O, S, Z) only check grid[py+1] for
top row collision. Flat pieces stack flush; T-pieces correctly
account for their protruding foot.
2026-02-27 12:52:13 -08:00
enzotar
30a3485440 fix: complete collision — checks both top row and bottom cell
Added grid[py+2] at px+1 check for the T-piece's protruding
bottom cell. Collision now checks 4 cells total per piece:
- grid[py+1] at px, px+1, px+2 (top row destination)
- grid[py+2] at px+1 (bottom cell destination)

This prevents pieces from passing through the angled/protruding
parts of frozen T-shaped blocks.
2026-02-27 12:47:37 -08:00
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