/// <summary>
        /// Create a block position spawner where the block positions are loaded from a file
        /// </summary>
        /// <param name="name">The name of the file to load</param>
        public BlockPositionSpawner(String name)
        {
            loadedPositions = BlockLoader.load(name);

            if (loadedPositions != null && loadedPositions.Count != 0)
            {
                currentBucket = new BlockStartPosition[loadedPositions.Count];
                nextBucket    = new BlockStartPosition[loadedPositions.Count];
            }
            else
            {
                currentBucket = new BlockStartPosition[7];
                nextBucket    = new BlockStartPosition[7];
            }

            setPossiblePositions(ref currentBucket);
            setPossiblePositions(ref nextBucket);
        }
Esempio n. 2
0
 /// <summary>
 /// A game of Tetris implemented as a WinForms application
 /// </summary>
 public TetrisGame()
 {
     InitializeComponent();
     createSquares();
     blocksetList.DataSource = BlockLoader.names();
 }