Example #1
0
        protected override void Create()
        {
            Reg.PS = this;
            //DebugDraw = false;

            Add(new FlxSprite(0, 0, "bg"));

            _scoreDisplay           = new FlxText(0, 180, FlxG.Width);
            _scoreDisplay.Alignment = FlxTextAlign.CENTER;
            _scoreDisplay.Color     = new Color(134, 134, 150);
            Add(_scoreDisplay);
            _scoreDisplay.Text = "Press Space to Start";

            Reg.HighScore = LoadScore();

            _highScore           = new FlxText(0, 40, FlxG.Width);
            _highScore.Alignment = FlxTextAlign.CENTER;
            _highScore.Color     = new Color(134, 134, 150);
            Add(_highScore);

            if (Reg.HighScore > 0)
            {
                _highScore.Text = Reg.HighScore.ToString();
            }

            _bounceLeft = new FlxSprite(1, 17);
            _bounceLeft.LoadGraphic(Reg.GetBounceImage(FlxG.Height - 34), true, 4, FlxG.Height - 34);
            _bounceLeft.Animation.Add("flash", new int[] { 1, 0 }, 8, false);
            Add(_bounceLeft);

            _bounceRight = new FlxSprite(FlxG.Width - 5, 17);
            _bounceRight.LoadGraphic(Reg.GetBounceImage(FlxG.Height - 34), true, 4, FlxG.Height - 34);
            _bounceRight.Animation.Add("flash", new int[] { 1, 0 }, 8, false);
            Add(_bounceRight);

            _paddleLeft = new Paddle(6, 1);
            Add(_paddleLeft);

            _paddleRight = new Paddle(FlxG.Width - 15, 0);
            Add(_paddleRight);

            _spikeBottom   = new FlxSprite(0, 0, "spike");
            _spikeBottom.Y = FlxG.Height - _spikeBottom.Height;
            Add(_spikeBottom);

            _spriteTop          = new FlxSprite(0, 0, "spike");
            _spriteTop.Rotation = MathHelper.ToRadians(180);
            _spriteTop.Y        = 0;
            Add(_spriteTop);

            _player = new Player();
            Add(_player);


            _feathers = new FlxEmitter();
            _feathers.Scale.Set(2, 2);
            _feathers.KeepScaleRatio = true;
            _feathers.LoadParticles("feather", 50);
            _feathers.Velocity.Set(-10, -10, 10, 10);
            _feathers.Acceleration.Set(0, 10);
            Add(_feathers);
        }