示例#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 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;
        }
示例#3
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            InputLimiter[HORIZONTAL].Update(gameTime);
            InputLimiter[VERTICAL].Update(gameTime);
            HandleInput(gameTime);

            //dropLimiter.Reset();
            //dropLimiter.Enabled = false;
            dropLimiter.Update(gameTime);
            if (dropLimiter.Ready)
            {
                BlockGroup bg = new BlockGroup(1, 1, blockGrid);
                BlockType  bt = (BlockType)RNG.Next(4);
                bg.Add(new Block(bt), 0, 0);
                blockGrid.Drop(bg, RNG.Next(blockGrid.NumCols));
            }
        }