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
pentominoes. Sometimes the term is generalized to apply to configurations of
four orthogonally connected cubes. There are seven possible shapes :
Planning this project actually took some time. Obviously you cannot
The design; in other words the form’s design, the user interface – what the
This part is probably the most important piece of the puzzle of all.
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
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.