Exemplo n.º 1
0
        /// <summary>
        /// Save the scores and dispose of the particles
        /// </summary>
        public override void UnloadContent()
        {
            SaveHighscore();

            particles = null;

            base.UnloadContent();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads all of the content needed by the game.  All of this should have already been cached
        /// into the ContentManager by the LoadingScreen.
        /// </summary>
        public override void LoadContent()
        {
            cloud1Texture = ScreenManager.Game.Content.Load<Texture2D>("cloud1");
            cloud2Texture = ScreenManager.Game.Content.Load<Texture2D>("cloud2");
            sunTexture = ScreenManager.Game.Content.Load<Texture2D>("sun");
            moonTexture = ScreenManager.Game.Content.Load<Texture2D>("moon");
            groundTexture = ScreenManager.Game.Content.Load<Texture2D>("ground");
            playerTexture = ScreenManager.Game.Content.Load<Texture2D>("Girambo");
            playerTextureUp = ScreenManager.Game.Content.Load<Texture2D>("GiramboUp");
            mountainsTexture = ScreenManager.Game.Content.Load<Texture2D>("mountains_blurred");
            hillsTexture = ScreenManager.Game.Content.Load<Texture2D>("hills");
            alienTexture = ScreenManager.Game.Content.Load<Texture2D>("alien1");
            badguy_blue = ScreenManager.Game.Content.Load<Texture2D>("cow");
            badguy_red = ScreenManager.Game.Content.Load<Texture2D>("badguy_red");
            badguy_green = ScreenManager.Game.Content.Load<Texture2D>("badguy_green");
            badguy_orange = ScreenManager.Game.Content.Load<Texture2D>("badguy_orange");
            bulletTexture = ScreenManager.Game.Content.Load<Texture2D>("chicken");
            laserTexture = ScreenManager.Game.Content.Load<Texture2D>("laser");

            spriteBatch = new SpriteBatch(ScreenManager.getGraphicsDevice());
            spriteTexture.Load(ScreenManager.getGraphicsDevice(), ScreenManager.Game.Content, "GiramboSprites", frames, framesPerSec);

            alienFired = ScreenManager.Game.Content.Load<SoundEffect>("Tank_Fire");
            alienDied = ScreenManager.Game.Content.Load<SoundEffect>("Alien_Hit");
            cowDied = ScreenManager.Game.Content.Load<SoundEffect>("Cow_Moo");
            playerFired = ScreenManager.Game.Content.Load<SoundEffect>("Tank_Fire");
            playerDied = ScreenManager.Game.Content.Load<SoundEffect>("Player_Hit");

            scoreFont = ScreenManager.Game.Content.Load<SpriteFont>("ScoreFont");
            menuFont = ScreenManager.Game.Content.Load<SpriteFont>("MenuFont");

            player.Width = playerTexture.Width;
            player.Height = playerTexture.Height;

            cloud1Position = new Vector2(224 - cloud1Texture.Width, 32);
            cloud2Position = new Vector2(64, 80);

            sunPosition = new Vector2(16, 16);

            background.Position = 0.0f;
            background2.Position = worldBounds.Right;

            particles = new ParticleSystem(ScreenManager.Game.Content, ScreenManager.SpriteBatch);

            LoadHighscore();

            base.LoadContent();

            // Automatically start the game once all loading is done
            Start();
        }