Written in rust, with the raylib-rs bindings for the raylib library.
Board: Used a vector of tetrominos that hold their own coords rather than a global array (for some reason), with width and height just for rendering
Tetrominos: Struct of vector of coords, with the center being the first coord in the vector
Collisions: Comparing current focused tetromino with every other tetromino on the board
Rotations: Used an offset table with indices to center O
and I
tetromino rotations as well as take care of wallkicks
How to Properly Rotate Tetris Pieces - Game Development Tutorial A video explaining how to implement tetromino rotations by Turbo Makes Games
- SRS website mentioned in the above video with offset data and explanations for how to use it