Ejemplo n.º 1
0
 public void Drop(GameGrid grid)
 {
     if (Brick4.Rect.Y != 298 && MovementFunctions.BlockDropCollision(this, grid))
     {
         Brick1.Rect.Y += 16;
         Brick2.Rect.Y += 16;
         Brick3.Rect.Y += 16;
         Brick4.Rect.Y += 16;
     }
 }
Ejemplo n.º 2
0
 void failState()
 {
     if (block.Brick1.Coordinate <= 10 && !MovementFunctions.BlockDropCollision(block, grid))
     {
         enableMenus(true);
         menus.Current = "Game Over";
         gameOver.Play();
         saveHighScore();
         updateHighScore();
     }
 }
Ejemplo n.º 3
0
        //This region contains the code for the main game update mehtod, fail state checking, and level setup and update.
        #region Update, Fail State, and Level Data
        void update(GameTime gameTime)
        {
            //If the block has reached the bootom or hit another block, check counter
            if (block.Brick4.Rect.Y == 298 || !MovementFunctions.BlockDropCollision(block, grid))
            {
                //If the update counter reaches 30, convert current block to grid, get new block, and check rows
                if (updateCounter == 30)
                {
                    gridFill();                  //Converts the block to the grid
                    block         = preview;     //Sets the preview block to the main block
                    preview       = randomize(); //Randomizes the next preview block
                    setNormalbool = true;
                    countRows();                 //Conts the number of blocks in a row
                    deleteBlocks();              //Deletes any full rows
                    updateMultiplier(gameTime);  //Updates the multiplier
                    updateScore(gameTime);       //Updates the score
                    levelUpdate(gameTime);       //Update the level
                    updateCounter = 0;           //Resets the counter
                }
                //Else update the counter
                else
                {
                    updateCounter++;
                }
            }
            //Else update counters
            else
            {
                reduceMultiplier(gameTime);
                dropCounter++;
                accelCounter++;
            }

            movementCounter++;
            failState();
        }