Пример #1
0
        public override void Initialize()
        {
            playerInput = new PlayerInput(PlayerIndex.One);
            this.Game.Components.Add(playerInput);

            playerInput.BindAction("Quit", Keys.Escape);
            playerInput.BindAction("Up", Keys.Up);
            playerInput.BindAction("Down", Keys.Down);
            playerInput.BindAction("Left", Keys.Left);
            playerInput.BindAction("Right", Keys.Right);
            playerInput.BindAction("Swap", Keys.Space);
            playerInput.BindAction("Explode", Keys.Z);
            playerInput.BindAction("ExplodeAll", Keys.X);

            playerInput.BindAction("Reset", Keys.Enter);

            playerInput.BindAction("Up", Buttons.DPadUp);
            playerInput.BindAction("Down", Buttons.DPadDown);
            playerInput.BindAction("Left", Buttons.DPadLeft);
            playerInput.BindAction("Right", Buttons.DPadRight);

            blockGrid = new BlockGrid(48, 48, 12, 10);

            blockGrid.X = 48;
            blockGrid.Y = 64;

            BlockGroup bg = new BlockGroup(3, 3, blockGrid);
            bg.Add(new Block(BlockType.White), 0, 1);
            bg.Add(new Block(BlockType.White), 1, 1);
            bg.Add(new Block(BlockType.White), 2, 1);
            bg.Add(new Block(BlockType.White), 2, 2);

            //blockGrid.Drop(bg, 2);
            blockGrid.Drop(bg, 4);

            InputLimiter = new Limiter[2]{new Limiter(InputLimiterInterval),new Limiter(InputLimiterInterval)};
            dropLimiter = new Limiter(0.15);

            burstEffect = new ParticleEffect_B();
            this.Game.Components.Add(burstEffect);

            explodeEffect = new ParticleEffect_C();
            this.Game.Components.Add(explodeEffect);

            blockGrid.BurstEffect = burstEffect;
            blockGrid.ExplodeEffect = explodeEffect;

            this.Game.Components.Add(blockGrid);

            base.Initialize();

            this.Enabled = true;
        }
Пример #2
0
 public BlockGroup(int rows, int cols, BlockGrid parent)
 {
     _Blocks = new Block[rows,cols];
     _NumRows = rows;
     _NumCols = cols;
     _Parent = parent;
 }