Пример #1
0
        public override void Update(GameTime gameTime)
        {
            if (FlxG.PixelPerfectOverlap(_player, _spikeBottom) || FlxG.PixelPerfectOverlap(_player, _spriteTop) ||
                FlxG.PixelPerfectOverlap(_player, _paddleLeft) || FlxG.PixelPerfectOverlap(_player, _paddleRight))
            {
                _player.Kill();
            }

            if (_player.X < 5)
            {
                _player.X          = 5;
                _player.Velocity.X = -_player.Velocity.X;
                _player.FlipX      = false;
                IncreaseScore();
                _bounceLeft.Animation.Play("flash");
                _paddleRight.Randomize();
            }
            else if (_player.X + _player.Width > FlxG.Width - 5)
            {
                _player.X          = FlxG.Width - _player.Width - 5;
                _player.Velocity.X = -_player.Velocity.X;
                _player.FlipX      = true;
                IncreaseScore();
                _bounceRight.Animation.Play("flash");
                _paddleLeft.Randomize();
            }

            if (FlxG.Keyboard.JustPressed(Keys.E) && (FlxG.Keyboard.AnyPressed(new Keys[] { Keys.LeftShift, Keys.RightShift, Keys.LeftControl, Keys.RightControl, Keys.RightAlt, Keys.LeftAlt })))
            {
                ClearSave();
                FlxG.ResetState();
            }

            base.Update(gameTime);
        }