public Stage1Screen(PlayerCharacter pc, Stage stage, EnemyList eList, FoodList fList)
 {
     player1 = pc;
     this.stage = stage;
     enemies = eList;
     foods = fList;
     TransitionOnTime = TimeSpan.FromSeconds(1.5);
     TransitionOffTime = TimeSpan.FromSeconds(0.5);
 }
Exemple #2
0
 // In general, the initial data needed for the stage to function will be loaded in the constructor.
 public Stage1(ContentManager content, GraphicsDevice graphics, EnemyList enemies)
 {
     activeEnemyList = new List<Enemy>();
     activeFoodList = new List<Food>();
     this.enemies = enemies;
     scrollingBackground testBG = new scrollingBackground();
     testBG.Load(graphics, content.Load<Texture2D>("BG\\bg_plain"),content.Load<Texture2D>("BG\\bg_mountain"),content.Load<Texture2D>("BG\\bg_volcano_1"));
     stageBG = testBG;
     stageTime = new TimeSpan();
     paused = false;
 }
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            gameFont = content.Load<SpriteFont>("gamefont");
            // Create a new SpriteBatch, which can be used to draw textures.
            viewportRect = new Rectangle(0, 0,
              (int)(this.ScreenManager.GraphicsDevice.Viewport.Width * .75f),
              this.ScreenManager.GraphicsDevice.Viewport.Height);
            enemyFieldBound = new Rectangle(
                -(int)(this.ScreenManager.GraphicsDevice.Viewport.Width * .25f),
                -(int)(this.ScreenManager.GraphicsDevice.Viewport.Height * .25f),
                (int)(this.ScreenManager.GraphicsDevice.Viewport.Width * 1.5f),
                (int)(this.ScreenManager.GraphicsDevice.Viewport.Height * 1.5f));

            if (enemies == null) enemies = new EnemyList(content);
            if (foods == null) foods = new FoodList(content);
            if (stage == null) stage = new Stage1(content, this.ScreenManager.GraphicsDevice, enemies);
            if (player1 == null)
            {
                player1 = new PlayerCharacter(
                content.Load<Texture2D>("PC\\player_flying"),
                content.Load<Texture2D>("PC\\player_death"),
                content.Load<Texture2D>("Bullets\\fireball0001"),
                content.Load<Texture2D>("Food\\foodgauge"),
                content.Load<Texture2D>("Food\\foodbar"),
                viewportRect);
                player1.LoadSounds(content);
            }
            healthBarBG = content.Load<Texture2D>("Enemies\\healthBar");
            healthBarFill = content.Load<Texture2D>("Enemies\\healthBarFill");
            UIFont = content.Load<SpriteFont>("UI");

            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            Thread.Sleep(1000);
            backgroundMusic = content.Load<SoundEffect>("Sounds\\backgroundmusic");

            instance = backgroundMusic.CreateInstance();
            instance.IsLooped = true;
            instance.Play();

            // 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();
        }