Example #1
0
        private void HandleMovement()
        {
            if (KeyPressed(Keys.Left))
            {
                Block newBlock = new Block(CurrentBlock);
                newBlock.Translate(new Point(-1, 0));

                if (ValidPosition(newBlock))
                    CurrentBlock = newBlock;
            }

            if (KeyPressed(Keys.Right))
            {
                Block newBlock = new Block(CurrentBlock);
                newBlock.Translate(new Point(1, 0));

                if (ValidPosition(newBlock))
                    CurrentBlock = newBlock;
            }

            if (KeyPressed(Keys.Up))
            {
                Block newBlock = new Block(CurrentBlock);
                newBlock.Rotate(true);

                if (ValidPosition(newBlock))
                    CurrentBlock = newBlock;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Down))
                dropDelay = 0.0625;
            else
                dropDelay = 0.5;
        }