Creating your own Tetris game using VB.NET | CodeGuru

Creating your own Tetris game using VB.NET

Introduction Seeing the fact that the game Tetris has turned 25, recently, I thought it’d be nice to create my own version of the popular game.  OK, not entirely different, the game still needs to have all the necessary shapes, called tetrominoes, but we’ll get to the complicated things a bit later.  For now, all […]

Written By
CodeGuru Staff
CodeGuru Staff
Feb 5, 2010
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Introduction

Seeing the fact that the game Tetris has turned 25, recently, I thought it’d
be nice to create my own version of the popular game.  OK, not entirely
different, the game still needs to have all the necessary shapes, called
tetrominoes, but we’ll get to the complicated things a bit later.  For now,
all you need to know is that we are going to create our own Tetris game,
throughout this article series.

Logic / Explanation

Tetris makes use of tetrominoes. A tetromino, also spelled tetramino or
tetrimino, is a geometric shape composed of four squares, connected
orthogonally. This is a particular type of
polyomino, just like
dominoes and
pentominoes. Sometimes the term is generalized to apply to configurations of
four orthogonally connected cubes.  There are seven possible shapes :

Shape Picture
I
O
T
L
J
S
Z

Planning this project actually took some time.  Obviously you cannot
just jump in and create the project and it will be perfect.  you always
have to think logically.  As it is, we can break down this game into 4
logical parts.

Part 1

The design; in other words the form’s design, the user interface – what the
user will see, and do.

Part 2

This part is probably the most important piece of the puzzle of all. 
Without this piece, there will be no game at all.  I am talking about the
Grid.  The grid is a set of invisible blocks.  Everything displayed,
will be in the grid.  having a grid will help us in determining where
precisely each shape ( and further each block of each shape ) is.  Having a
grid further simplify our shapes’ navigation.

Part 3

A Display object. No, it is not the graphics object with which we draw. 
It is a separate object which basically assists in double buffering.  This
means that there will be no glitches or breaks in animation during the game. 
How this works is that it creates a separate graphics object, and copies the
current objects to an from it, but more on that in the next instalment of this
series.

Part 4

Shapes.  The shapes must be handled separately.  The physical
drawing of the shapes, plus the movement of them.  This will be explained
later in the article series.

We will cover only the first 2 logical
parts of this game, in this article. The design is not much work.  The real
work came in with creating the Grid.  With the Grid, we have to make sure
we always know where is which object; we also need to make sure that all colours
are placed correctly, and most importantly, we have to determine the empty
spaces and the used spaces – we cannot place the shapes properly then. Let us start with the design of our form.

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.