Workshop › Tetris-style Blocks › Step 8 of 32
All seven pieces
What we are doing
Four more pieces complete the set: S and Z (zigzags) and J and L (hooks). Each has four blocks, all with its own
number.
```js
[
[0, 4, 4],
[4, 4, 0],
[0, 0, 0],
],
[
[5, 5, 0],
[0, 5, 5],
[0, 0, 0],
],
[
[6, 0, 0],
[6, 6, 6],
[0, 0, 0],
],
[
[0, 0, 7],
[7, 7, 7],
[0, 0, 0],
],
```
What it means
- S and Z are mirror images, and so are J and L. All four are 3×3 with an empty bottom row, like the T.
Your turn
In SHAPES, after the T's closing ],, write the four matrices, before the list's closing ].
Skills: Arrays and objects
← A list of shapes Does it fit inside the well? →
All steps
- The well
- The board as rows of numbers
- Draw one cell
- Draw the whole board
- The number is the color
- A piece is a small grid
- A list of shapes
- All seven pieces
- Does it fit inside the well?
- Blocks are in the way
- Try, then move
- Move with the arrows
- Turn a matrix
- Turn with Up
- Wall kicks
- Falling by itself
- A random piece at the top
- Land and lock
- One function starts a game
- When the pile reaches the top
- Game Over on screen
- Play again
- Clear full rows
- Points for lines
- The side panel
- Levels
- Faster every level
- A fair bag of pieces
- The next piece
- Drop it
- The ghost piece
- Build it yourself: hold a piece