Back to projects

B TETRIS

How to play

Play the game here

Swipe the touch screen or use arrow keys to move and rotate the piece. Complete a full row to clear it. Beware, the game gets faster each time you do that. If your stacked pieces reach the top of the screen, you lose!

Controls

Move the pieceLeft/Right swipe or arrow keys
RotateUp swipe or arrow key
Slam the piece downDown swipe or arrow key
Bank the pieceTap or click the Bank button

Source code

Github

Developer Log

While making my previous game B SNAKE, I learned how fun and addicting it is to build games with C# and Blazor. WebAssembly (WASM) is ultra-convenient for me as a dev and for players. I get to program in the same language I use at work every day, and players can play a game on their phone or PC without installing anything.

After I completed B SNAKE, I realized I had a useful template for future games and that I had already gotten through the "absolute noob" stage of my gamedev journey. So, I used it to make more games!

Resurrecting my old Tetris game

I actually already built a Tetris clone in C# some years ago, but it ran in the console and was rendered terribly by my custom ConsoleTetrisRenderer class.

old game screenshot running in the console. it's not pretty

It became clear to me that I could massively revamp the game's graphics and playability by adapting it to my new Blazor game template. Once the scaffolding was set up, all I'd need to do is create a new renderer implementation that draws to the Blazor HTML5 Canvas. And so I did that! I fixed some bugs with piece rotations and added a button to bank the current piece.

Conclusion

This project was a blast because of how easy it was - all I did was pop in an old library to this project, add a class, adjust a few things - and I had an ACTUAL Tetris game, with graphics, within a few hours. This showed me that re-using code can pay dividends when you want to focus on the next exciting challenge.