Exemple #1
0
        public void Start()
        {
            m_blockCurrent = new Block(this);
            m_blockCurrent.Create();

            m_blockNext = new Block(this);
            m_blockNext.Create();

            while (m_blockNext.ColorIndex == m_blockCurrent.ColorIndex)
            {
                // same block, keep trying until our current and next blocks are
                // different - saw too many instances where the two blocks at the
                // start of a game are the same.
                Thread.Sleep(100);
                m_blockNext.Create();
            }

            // shift the current block into the playing area
            m_blockCurrent.Y -= 5;

            m_nScore = 0;
            m_nLines = 0;
            m_nLevel = 0;

            // clear the board
            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    m_nBlock[x, y] = 0;
                }
            }

            m_nState = State.Running;
        }
Exemple #2
0
    public void Start()
    {
      m_blockCurrent = new Block(this);
      m_blockCurrent.Create();

      m_blockNext = new Block(this);
      m_blockNext.Create();

      while (m_blockNext.ColorIndex == m_blockCurrent.ColorIndex)
      {
        // same block, keep trying until our current and next blocks are
        // different - saw too many instances where the two blocks at the
        // start of a game are the same.
        Thread.Sleep(100);
        m_blockNext.Create();
      }

      // shift the current block into the playing area
      m_blockCurrent.Y -= 5;

      m_nScore = 0;
      m_nLines = 0;
      m_nLevel = 0;

      // clear the board
      for (int x = 0; x < Width; x++)
      {
        for (int y = 0; y < Height; y++)
        {
          m_nBlock[x, y] = 0;
        }
      }

      m_nState = State.Running;
    }