петак, 6. јануар 2012.

"The Same Game": A Simple Game from Start to Finish, Part 1 of 5

Foreword to Same Game

In this five part series, we'll be creating a version of a game called SameGame usingthe Microsoft Foundation Class library from start to finish. We'll includefeatures beyond the simple removing of blocks in the game. We'll implement anundo/redo subsystem and some user configuration dialogs. We'll show you stepby step with not only source code but screenshots how to build a fun game fromstart to finish and how to use Microsoft's MFC classes. Every article comes with complete source code, so you can build and run the game yourself.

The rules to the SameGame are quite simple, you try to remove all of the colored blocks from the playing field. In order to remove a block the player must click on any block that is next to, vertically or horizontally, another with the same color. When this happens all of the blocks of that color that are adjacent to the clicked block are removed. All of the blocks above the ones removed then fall down to take their place. When an entire column is removed, all columns to the right are shifted to the left to fill that space. The blocks aren't shifted individually but as a column. The game is over when there are no more valid moves remaining. The goal is to end with an empty board in as little time as possible. Some versions of the SameGame use a scoring algorithm that can be implemented as an additional exercise for the user.

Prerequisites

You'll need to have a basic C

View the Original article

Нема коментара:

Постави коментар