// Load graphics content for the game
        public override void Activate()
        {
            if (_content == null)
            {
                _content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            _gameFont    = _content.Load <SpriteFont>("gamefont");
            _spriteBatch = new SpriteBatch(ScreenManager.GraphicsDevice);

            batSprite  = new BatSprite();
            exitSprite = new ExitSprite();

            background = _content.Load <Texture2D>("dark-cave");

            explosion = new ExplosionParticleSystem(ScreenManager.Game, 20);
            ScreenManager.Game.Components.Add(explosion);
            SoundEffect.MasterVolume = 0.5f;

            firework = new FireworkParticleSystem(ScreenManager.Game, 20);
            ScreenManager.Game.Components.Add(firework);
            //Creates initial coins.
            System.Random rand = new System.Random();
            coins = new CoinSprite[]
            {
                new CoinSprite(new Vector2((float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Width, (float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Height)),
                new CoinSprite(new Vector2((float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Width, (float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Height)),
                new CoinSprite(new Vector2((float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Width, (float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Height)),
                new CoinSprite(new Vector2((float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Width, (float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Height)),
                new CoinSprite(new Vector2((float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Width, (float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Height)),
                new CoinSprite(new Vector2((float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Width, (float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Height)),
                new CoinSprite(new Vector2((float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Width, (float)rand.NextDouble() * ScreenManager.GraphicsDevice.Viewport.Height))
            };

            foreach (var coin in coins)
            {
                coin.LoadContent(_content);
            }
            batSprite.LoadContent(_content);
            bangers = _content.Load <SpriteFont>("bangers");
            exitSprite.LoadContent(_content);
            coinPickup              = _content.Load <SoundEffect>("Pickup_Coin14");
            backgroundMusic         = _content.Load <Song>("Bio Unit - Docking");
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Play(backgroundMusic);

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes the ScreenManager
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization logic here
            _rain = new RainParticleSystem(this.Game, new Rectangle(0, -50, 650, 827));
            this.Game.Components.Add(_rain);

            _fireworks = new FireworkParticleSystem(this.Game, 20);
            this.Game.Components.Add(_fireworks);

            _pop = new PopParticleSystem(this.Game, 15);
            this.Game.Components.Add(_pop);

            base.Initialize();
            _isInitialized = true;
        }
Esempio n. 3
0
        // Load graphics content for the game
        public override void Activate()
        {
            if (_content == null)
            {
                _content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            end = false;

            eggs = new EggSprite[]
            {
                new EggSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 60, 240), false),
                new EggSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 60, 340), false),
                new EggSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 60, 440), false),
                new EggSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 60, 540), false),
                new EggSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 60, 640), false),
                new EggSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 60, 740), false)
            };

            balloons = new BalloonSprite[]
            {
                new BalloonSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 64, 250), true),
                new BalloonSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 64, 350), true),
                new BalloonSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 64, 450), false),
                new BalloonSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 64, 550), true),
                new BalloonSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 64, 650), true),
                new BalloonSprite(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width + 64, 750), true)
            };

            bird = new BirdSprite();

            c = new BoundingCircle(new Vector2(0, 0) + new Vector2(16, 16), 16);

            _rain      = ScreenManager._rain;
            _fireworks = ScreenManager._fireworks;
            _pop       = ScreenManager._pop;

            _foreground = _content.Load <Texture2D>("Rough_Game_Foreground");
            _midground  = _content.Load <Texture2D>("Rough_Game_Hills");
            _background = _content.Load <Texture2D>("Rough_Game_Sky");

            MediaPlayer.Volume       = ScreenManager.Volume;
            SoundEffect.MasterVolume = ScreenManager.Volume;

            SpriteBatch = ScreenManager.SpriteBatch;

            foreach (var egg in eggs)
            {
                egg.LoadContent(_content);
            }
            foreach (var balloon in balloons)
            {
                balloon.LoadContent(_content);
            }
            bird.LoadContent(_content);
            _font           = _content.Load <SpriteFont>("bangers");
            eggPickup       = _content.Load <SoundEffect>("birdchirping071414");
            popSound        = _content.Load <SoundEffect>("pop");
            backgroundMusic = _content.Load <Song>("007_Synthwave_421k");
            MediaPlayer.Play(backgroundMusic);
            MediaPlayer.IsRepeating = true;

            choice = 3;

            heart = _content.Load <Texture2D>("Rough_Game_Heart");

            //Pause to allow player chance to read instructions
            Thread.Sleep(5000);

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }