コード例 #1
0
ファイル: ParticleEffect_A.cs プロジェクト: fchorney/BlockXNA
        public override void Update(GameTime gameTime)
        {
            _Limiter.Update(gameTime);
            if (_Limiter.Ready && true)
            {
                //Params:
                //0: x-speed
                //1: y-speed
                Particle p = CreateParticle(RNG.Next(-200, 200), RNG.Next(-100, 100), RNG.Next(-100, 100));
                p.TimeToLive = 20;
                p.X          = x;
                p.Y          = y;
                p.Scale      = 0.1f;

                p.Transform  = null;
                p.Transform += SinXFunction;
                p.Transform += SinYFunction;

                Animation frame = AnimationFactory.GenerateAnimation(@"Lensflare", 256, 256, 1, 0);

                p.Sprite = new Sprite(frame, new Vector2(100, 100));
                // p.Sprite.Animation.CurrentFrame = RNG.Next(5);

                this.Add(p);
            }

            base.Update(gameTime);
        }
コード例 #2
0
ファイル: BlockTest.cs プロジェクト: fchorney/BlockXNA
        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));
            }
        }