Compare commits
9 Commits
fb535106ca
...
4c35daac3e
| Author | SHA1 | Date |
|---|---|---|
|
|
4c35daac3e | 6 days ago |
|
|
0d1a680625 | 7 days ago |
|
|
7ef5a73704 | 1 week ago |
|
|
c4394f9728 | 2 weeks ago |
|
|
c21636629e | 2 weeks ago |
|
|
f0d41f15ee | 2 weeks ago |
|
|
f6aae11f8c | 2 weeks ago |
|
|
2cab218e5c | 2 weeks ago |
|
|
b51884ac69 | 2 weeks ago |
@ -0,0 +1,45 @@
|
||||
# Design
|
||||
|
||||
## Tetris
|
||||
|
||||
Matrix Multiplication for rotating pieces.
|
||||
|
||||
Each piece (shape) contains a Mat4 containing a representation of it's shape.
|
||||
For example:
|
||||
|
||||
```
|
||||
0 1 0 0
|
||||
0 1 0 0
|
||||
0 1 0 0
|
||||
0 1 0 0
|
||||
```
|
||||
|
||||
This is the classic `line` piece.
|
||||
|
||||
And here it is on it's `up` side
|
||||
|
||||
```
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
0 0 0 0
|
||||
0 0 0 0
|
||||
```
|
||||
|
||||
And here is the `t` piece
|
||||
|
||||
```
|
||||
0 1 0
|
||||
1 1 1
|
||||
0 0 0
|
||||
```
|
||||
|
||||
A matrix multiplication is applied to this Mat6 to achieve a piece rotation.
|
||||
|
||||
When that matrix is updated, the 4 blocks parented to the shape are moved to reflect this new shape.
|
||||
|
||||
This matrix also allows us to do checks to see if any of the blocks in the shape would intersect with another piece on the board.
|
||||
We can also check if a piece would go out of bounds during a move or rotation.
|
||||
|
||||
We can use this to "plan -> validate -> commit" changes based on user input.
|
||||
|
||||
Question: How the fuck do matrix multiplications work??
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue