Skip to content

Latest commit

 

History

History
36 lines (23 loc) · 1.79 KB

README.md

File metadata and controls

36 lines (23 loc) · 1.79 KB

Tetris-wgpu-rs

A port of raylib-tetris -> wgpu, also using rodio for audio. Api inspiration for thomas engine from ggez.

Picture of Tetris Game Over Screen

Implementation

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

Helpful Resources

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

Learned basic wgpu api from learn-wgpu, projections from, learnopengl, batch rendering and engine design from The Cherno

Running

Install nightly rust compiler

rustup install nightly

Clone repo & build run

git clone https://github.com/SpicyRicecaker/tetris-wgpu-rs/tree/master
cd tetris-wgpu-rs
cargo run --release