BlockFall is an emulation of the classic game Tetris. The game is comprised of two game modes (originally three*) – Levels and Survival. Levels will have you working to complete 10 row clears to progress a total of ten possible levels. Survival will test your hand eye coordination as you draw ever closer to your inevitable defeat… or are you?

Scoring is calculated using a pretty basic system. You get 10 points per line, and for each line in a single clear permutation you add 1 to the total point multiplier. In addition, for each free fall block (block that is calculated as having no supporting blocks and “falls” until it rests) that falls and completes another row, you add 1 to a base additional multiplier, multiplying total previously multiplied point value.
Line Point Value (x1 = 10)
Additional Lines Per Clear ((10 x Lines) x NumLines)
Additional Free Block Fall Line Clears (Total Points x (Num Phase Clear + 1))
E.g. 4 initial cleared lines with 2 additional free block fall clears = (((((4 x 10) x 4) + 10) x 2) + 10) x 3)
The game works using a system of Block[,] multidimensional arrays that contain Block data. A block contains a Color, an isLocked property, a ShapeID, and a BlockID.
The Color indicates the color the block should render as, the isLocked is defaulted to false and set to true once a block as been frozen (found a resting spot). The ShapeID associates multiple blocks into a single cohesive formation and assists with the block fall logic. The BlockID is like a guid and allows the application to pull individual named blocks (Block.Name) from the LayoutRoot. Silverlight doesn’t like removing children and then adding another with the same name, even after you’ve cleared the parent container control.
The actual board is managed using a static Matrix class that contains a number of properties, including an ActiveMatrix[,]. This ActiveMatrix is used to track current block/shape positions using an ActivePoint.X and ActivePoint.Y static point to track a shapes current position, projected rotation and directional movement (for movement/rotation validation), and new block insertion. The ActivePoint is as well used in conjunction with the ActiveMatrix to verify that movement is possible at all or if the last possible move has been enacted and the game is lost. As well, the ActiveMatrix stores all previously frozen blocks and allows recursive logic to evaluate newly formed full rows for clear when the current active shape has come to a resting point.
The Matrix class as well contains a number of shape definitions for base shapes, multidimensional arrays of Block, as well as List
> that is used to store Custom Defined Blocks. A Custom Game Mode was originally designed for this application and was successfully implemented pending a few modifications that I realized would require a significant overhaul of the custom game setup interface and logic. I’ve decided to forego the implementation of this feature for now as other pressing matters in my life require my attention.
The heart of the application is a DispatcherTimer fittingly named dp_Main. dp_Main’s interval time is controlled by a function contained in a static Game class that holds data regarding levels, points, cleared rows, etc., as well as a function that determines the correct TimeSpan length for the current level based on that level’s number. The Tick eventhandler behavior associated with dp_Main is determined by the current running game process (Need to add a New Block, Processing Row Clears/Points, Game Paused, etc.).
All Graphics associated with BlockFall are custom design by me (Bron Skinner). All music, except for the game’s default music (Tetris theme from the GameBoy Advance I believe) is thanks to IStockPhoto.