Click here to Skip to main content
Click here to Skip to main content

Brick 2005 Game Engine (formerly Tetris 2005 Game Engine)

, 16 Nov 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
A Game engine tutorial describes how to play the game and how to customize the game. The game is user friendly that lets you to change the view, difficulty, etc. without changing the VB code.
Sample Image - Main.gif

Table of Contents

Introduction: What is Tetris '2005?

Tetris '2005 is an exciting action game. Throughout the game, bricks of various types fall from the top to the bottom of the playing area. When the bricks form a solid row of blocks across the playing area, that row vanishes.

Because this is the only way to remove blocks, you should try to form solid rows whenever possible. The game ends when the pieces stack up to the top of the playing area.

You can manipulate a brick only when it is falling. Falling pieces may be rotated, moved horizontally, or dropped to the bottom of the playing area.

This nice and small game offers High score lists, Preview Screen, Position Pointer and more. It has no multimedia but is intended to bring a taste of fun to a small break on a long, hard working day. However, if you would like to support my work, please rate this article and visit one of my other programs.
Check them out!

User's Manual

I realize that a number of people will just want to try out the sample and see if it is worth spending the time looking at the source code. So I will first present the game, the controls, then I will explain how it works in later sections.

This intermediate tutorial describes how to play Tetris and how to move Bricks.

The Bricks

The "." brick
The ":" brick
The "H" brick
The "I" brick
The "J" brick
The "L" brick
The "N" brick
The "O" brick
The "T" brick
The "Z" brick

Rules of the Game

Bricks appear one at a time at the top of the playing area and then proceed to fall at a constant speed.

Each brick continues to fall until it lands on another brick or the bottom of the playing area.

You can manipulate a brick only when it is falling.

With the keyboard, you can rotate a falling brick and move it left, right, or down.

Each time there is a solid row of blocks across the playing area, that row vanishes. Try to manipulate the pieces as they fall so that solid rows form and disappear.

The game ends when the pieces are stacked to the top of the playing area.

Keyboard Functions

Up Arrow,

Insert,

Home Rotates the current brick
Left Arrow Moves the current brick left
Right Arrow Moves the current brick right
Down Arrow, Drops the current brick to the bottom

Options

[ ] Show preview screen

By unchecking this option, the preview box in which the upcoming brick is displayed, will be hidden. This results in special bonus points.

[ ] Show position pointer

By checking this option, RSM's Tetris 2005 will display a position pointer at the bottom of your "playground" to ease navigation of your pieces. Read the Scoring section for information about how this could influence your bonus points.

Skill Level

Here you can choose from which level to start playing. User can Select level according to their desire. Beginner for new user, Intermediate for Normal and Expert is suggested for advanced users.

Background Color

Click on the color preview area to change the background color of your RSM's Tetris 2005 "playground".

Playing the Game

The object of RSM's Tetris 2005 is to continue playing for as long as possible. The game is over when the playing area is stacked to the top with bricks. The following section explains how to play the game.

To Choose a Skill Level:

In the Options menu, choose a starting level from 1 to 20. The higher the level, the faster the pieces fall.

To Start a New Game:

From the buttons at the right, choose Start.

To Move a Brick Horizontally:

Use the appropriate keyboard controls. You can move the current brick either left or right.
Note: If the current brick is close to the borders or close to already-positioned pieces, you may be unable to move it.

To Rotate a Brick:

Use the appropriate keyboard controls. You can rotate the current brick 90 degrees counterclockwise.
Note: If the current brick is close to the borders or close to already-positioned pieces, you may be unable to rotate it.

To Drop a Brick:

Use the appropriate keyboard controls. When you drop a brick, it falls rapidly until it lands on a stationary brick or the bottom of the playing area.

To Pause a Game:

From the Game menu, choose Pause, or Click Pause Button.

Note: To resume the game, choose Pause again.

Scoring

The current brick starts with an initial score value, which increases for each successive playing level.

The "Tetris '2005 Hall Of Shame"

If you achieved a new High score (this means, if you achieved more points than the ones listed in the "RSM's Tetris 2005 Hall Of Shame" window), a special window opens and you can add your name and a "cool quote" of your choice to this list !

You can also use the "Save" button to save your High score window to bitmap file named "HiScore.bmp".

Strategy and Hints

This section contains helpful hints for playing RSM's Tetris 2005 successfully.

  • Use the Brick Preview box to gain experience, and then turn this option off for higher scoring.
  • Experiment with the position pointer tool .. based on your reaction time, does it bring you more points than it costs ?
  • Avoid building "mountains." Try to keep the pile of pieces level at the top.
  • Avoid creating "canyons" that are one block wide and many blocks deep. You may find yourself nervously waiting for the long, skinny brick (which never seems to appear when you need it).
  • Always try to leave a "flat spot" at least three blocks wide along the top of the stacked pieces. This way you can drop most of the pieces without leaving any gaps.
  • Sometimes it is to your advantage to leave a gap and go on to the next level. If you can make the next level disappear, you may have time to fill the gap afterwards.
  • Once a brick lands on another brick, it can still be manipulated for a very short time. You can use this time to "slide" the brick under an "overhang."

Using the Code

Detailed comments can be found in the source archive.The game is built up from a number of smaller sub-systems. Each system provides a distinct purpose. I have identified the systems below.

Architecture

  • Game Engine
  • Main Window
    • Brick Display
    • Preview Screen
    • Position Pointer
    • 2D Button Display
  • Option Window
  • Score window
  • Help window

CORE ENGINE

The Tetris Core engine consists of the main four functions:

  • SelectBrick
  • SetCurrentPosition
  • DrawBrick
  • HideBrick

These functions provide support for brick related functions such as selecting a Brick, setting the current Position of the Brick, showing and hiding a Brick.

The core engine is implemented as a strict back-end engine. It has no user-interface components. Most of the functions return an Boolean return code. The return codes should always be examined to determine the completion status of these functions.

Special care has been taken to ensure that these functions are very stable and robust.

Public Sub SelectBrick()

This Subroutine is used to select Brick type.

Public Sub HideBrick(frm As Form)

This Subroutine is used to Hide all Bricks in the frm Form.

Public Sub DrawBlock(frm As Form)

This Subroutine is used to Show selected Brick in the frm Form.

Public Sub SetCurrentPosition(a As Integer, Optional b, _
	Optional c, Optional d, Optional e, Optional f)

This Subroutine is used to set initial position of Brick in the frm Form.

Other Functions of Importance

Public Sub Increment(X As Integer) 

This function is called when a user presses Left, Right or Down key from within the Main Window KeyDown Event. It increments the value of next position variables.

Public Sub CheckStatus(X As Integer, a As Integer, Optional b, _
	Optional c, Optional d) 

This function is called after Increment to check the availability of the position specified in next position variables.

Public Sub MoveBlock() 

If CheckStatus function returns true, then this function is called to move the current brick to the next position.

Public Sub CheckRowBuilt(frm As Form)

This function checks the status of each row and if any row is built, i.e., a row having 10 bricks, then removes that row and increases the score.

Public Function CheckGameOver(frm As Form) As Boolean 

This function is used to check the status of the game before drawing the new brick.

Public Sub frmOptionSetting() 

This function is used to change the game setting according to the setting user made using Option Window.

Public Sub LoadScoreFile(frm As Form) 

This function is used to Load score from the files to the Score Window.

Public Function CheckGameOver(frm As Form) As Boolean 

This function is used to Save score.

Preview Screen

The Preview Screen Module consists of the three functions:

Public Sub HidePicBox(frm As Form) 

This function is used to clear Preview Screen.

Public Sub ShowPicBox(frm As Form, a As Integer,Optional b, _
	Optional c, Optional d, Optional e,Optional f) 

This function is used to display Preview of next brick.

Public Sub ShowPreview(frm As Form) 

This function is used to set the position of the brick in the Preview window.

Position Pointer

The Position Pointer Module consists of the three functions:

Public Sub ShowPositionPointer(frm As Form) 

This function is used to display Position Pointer.

Public Sub HidePositionPointer(frm As Form) 

This function is used to Hide Position Pointer.

Public Sub SetPositionPointer() 

This function is used to set the Position of Position Pointer in Main Window.

2D Button Display

To display 2D button, we have to manipulate some of the Image box Mouse Events:

Private Sub imgbutton_MouseMove(Index As Integer, Button As Integer, _
	Shift As Integer, X As Single, Y As Single) 

In this Event, we draw rectangle with the help of Grey and White lines.

Private Sub imgbutton_MouseDown(Index As Integer, Button As Integer, _
	Shift As Integer, X As Single, Y As Single) 

In this Event, we change image box left and top Position.

Private Sub imgbutton_MouseUp(Index As Integer, Button As Integer, _
	Shift As Integer, X As Single, Y As Single) 

In this Event, we restore Image box left and top Position.

Private Sub imgbutton_DblClick(Index As Integer)

In this Event, we execute commands according to Image box index.

Option Window

Option Window gives the user the facility to configure the game setting according to their need.

Score Window

Score Window displays the detail list of users who achieved the highest score.

Help Window

Help Window displays Keyboard functions.

Conclusion

I would like to give credit and thanks to my brother Rohit Soam for constructive criticism & editing, and also to my friend Nikhil who helped me in testing the game.

History

THE STORY

I started the whole thing by writing a small game including sources (based on Turbo C++). Since it has always been my (Mohit's) dream to create a logic game like this one, but I've never taken the time to even think about where to start with, I took the chance. We put ourselves together, added some nice features we knew people like you would like and here it is !

Everything we did on that game is just for our fun. It makes us happy to receive mails from you telling us if you like the game, why you like it (why you don't like it ... well, not sure ~'.'~ ) .

NOTE

RSM's Tetris 2005 is in no way affiliated with 'The Tetris Company' nor is it an official Tetris product. The Graphical Interface of Game is based on Bricks 2005 .

  • 8-Aug-2005 - Initial release of "RSM Tetris 1.1"

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Mohit Soam
Web Developer
India India
FD 100
RT 135
FD 50
LT 90
FD 50
RT 45
FD 100
 
output : M
 
that's my first code in LOGO, when i was in VI standard.
 
it's me... Mohit.
 
from Holy City of India.... Rishikesh.
I love programming, not much else to say
 
"Those who dreams the most do the the most"

RSM 4 U

Comments and Discussions

 
GeneralTetris 2005 VB6 PinmemberMember 35335822-Nov-12 2:48 
GeneralThanks Pinmembermshln6-Sep-08 20:50 
Question.net? Pinmemberxxcoder6-Nov-07 5:10 
AnswerRe: .net? PinmemberThomas Stockwell7-Jul-08 4:14 
Questionsierpinski triangle Pinmembersara_ayu651-Jun-07 4:05 
HI
I want write the code of sierpinski in turbo c++,& i need help for this project.
thanks alot
regard
 
sara setareh

GeneralHoe Ajarin Gua buat Game DOnk!!, you, PLease teach me make a games ! PinmemberRadityoHernanda5-Jul-06 19:05 
Generalhello mohit PinmemberShashikant_200631-May-06 1:50 
GeneralRe: hello mohit Pinmemberaicelle24-Aug-06 15:37 
GeneralRe: hello mohit Pinmemberaicelle24-Aug-06 15:38 
Generalvery good Pinmembersadirov3-Dec-05 16:52 
Generaltetris 2oo5 [modified] PinmemberSamuelPlentz24-Aug-05 1:04 
GeneralRe: tetris 2oo5 Pinmemberjitendra chaurasia1-Apr-10 6:24 
Generalfun app PinmemberDonsw21-Aug-05 14:59 
GeneralApp is VB6 not VB.NET PinsussAnonymous10-Aug-05 7:18 
GeneralRe: App is VB6 not VB.NET Pinmembertseiber_gmail11-Aug-05 4:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 16 Nov 2012
Article Copyright 2005 by Mohit Soam
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid