Tetris in Blazor Part 2: Cells, the Grid, and the Game State

Tetris in Blazor Part 2: Cells, the Grid, and the Game State

Let's start the process of making Tetris in Blazor by building the C# classes for the grid, the cells, and the game state. Tetris in Blazor Part 2: Cells, the Grid, and the Game State

With our logical model we worked out in  the first part of this series, we can begin to construct the C## model for our Tetris demo. Let's begin coding up our Tetris in Blazor demo by creating classes for the cells, the grid, and the game state.

This is part of our ultimate goal. We've still got a ways to go. Don't give up!

The Sample Project

Don't forget to check out the entire BlazorGames repository over on GitHub! All the code used in this series is there.

Cells

The smallest unit we can break our Tetris model into is a cell, or a single spot on the game grid.

Each of these little blocks is an individual cell

At the most basic, a cell is either filled or not filled, occupied or not occupied. A cell must also have a position, or coordinate, in the larger grid (so that no two cells have the same coordinates).

There's one small trick we must also account for: since cells can be filled by different colors (each tetromino is a different color) each cell must also have its own CSS class.

blazor deep dives games asp.net

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

jQuery Ajax CRUD in ASP.NET Core MVC with Modal Popup

In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.

Blazor for ASP.NET Web Forms Developers PDF

In this blog post, I will share the Free e-book: Blazor for ASP.NET Web Forms Developers PDF. This book is great for ASP.NET Web Forms developers looking for guidelines. As well as strategies for migrating their existing apps to a modern, open-source, and cross-platform web framework.

Hire ASP.Net Developers

Looking to outsource your asp dot net development requirement? ASP.Net is a special feature of the DOT Net framework created by Microsoft. At [HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io"), we have a team of experienced...

Game Development with .NET

.NET is cross-platform. With .NET you can target over 25+ different platforms with a single code base. You can make games for, but not limited to, Windows, macOS, Linux, Android, iOS, Xbox, PlayStation, Nintendo, and mixed reality devices.

MVC User Registration & Login with ASP.NET Core Identity

In this article, we will discuss the quickest way to use ASP.NET Core Identity for User Login and Registration in a new or existing MVC application.