Esempio n. 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load the player resources
            Animation playerAnimation = new Animation();
            Texture2D playerTexture   = Content.Load <Texture2D>("Animation/shipAnimation");

            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true);

            Animation player2Animation = new Animation();
            Texture2D jet = Content.Load <Texture2D>("Animation/plane");

            player2Animation.Initialize(jet, Vector2.Zero, 125, 77, 8, 30, Color.White, 1f, true);

            Animation player3Animation = new Animation();
            Texture2D plane            = Content.Load <Texture2D>("Animation/Animatedship");

            player3Animation.Initialize(plane, Vector2.Zero, 115, 62, 8, 30, Color.White, 1f, true);

            healthTexture = Content.Load <Texture2D>("Animation/red");
            Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);

            player.Initialize(playerAnimation, playerPosition, healthTexture);
            player2.Initialize(player2Animation, playerPosition, healthTexture);
            player3.Initialize(player3Animation, playerPosition, healthTexture);
            // Load the parallaxing background
            bgLayer1.Initialize(Content, "Texture/bgLayer1", GraphicsDevice.Viewport.Width, -1);
            bgLayer2.Initialize(Content, "Texture/bgLayer2", GraphicsDevice.Viewport.Width, -2);

            spriteBatch = new SpriteBatch(GraphicsDevice);

            mainBackground = Content.Load <Texture2D>("Texture/mainbackground");

            projectileTexture = Content.Load <Texture2D>("Texture/laser");

            enemyTexture = Content.Load <Texture2D>("Animation/mineAnimation");

            explosionTexture = Content.Load <Texture2D>("Animation/explosion");

            menuItem = Content.Load <Texture2D>("Texture/MenuItem");

            gameoverImage = Content.Load <Texture2D>("Texture/gameOver");

            //// Load the score font
            //font = Content.Load("Font/gameFont");


            //Load the music
            gameplayMusic = Content.Load <Song>("Sound/gameMusic");

            // Load the laser and explosion sound effect
            laserSound     = Content.Load <SoundEffect>("Sound/laserFire");
            explosionSound = Content.Load <SoundEffect>("Sound/explosion");

            // Start the music right away
            PlayMusic(gameplayMusic);

            //TODO: use this.Content to load your game content here
        }