Ejemplo n.º 1
0
        // Moves current block to the right
        // Will check boundaries, will do nothing if the game is over
        public void MoveRight()
        {
            if (game_end)
            {
                return;
            }
            Tetromino f = this.minos.First();

            if (f.GetRight() < 10 * this.scale)
            {
                // check if any blocks are to the right
                bool go = true;
                foreach (System.Drawing.Rectangle rect in f.GetRectangles(0, 0))
                {
                    int x = (rect.X + this.scale) / this.scale;
                    int y = rect.Y / this.scale;
                    if (y < 0)
                    {
                        continue;
                    }
                    go &= (grid[x, y].Color == System.Drawing.Color.FromArgb(128, 255, 255, 255));
                    if (y < 20)
                    {
                        go &= (grid[x, y + 1].Color == System.Drawing.Color.FromArgb(128, 255, 255, 255));
                    }
                }

                if (go)
                {
                    f.Shift(true);
                }
            }
        }