Compare commits
No commits in common. '4c35daac3e9663c6dd2a11bcd7137276c051971c' and 'fb535106cae403ec72b94b46f029b52f7cfe6a08' have entirely different histories.
4c35daac3e
...
fb535106ca
@ -1,45 +0,0 @@
|
|||||||
# 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