public void LevelClear() //Clears the previous level, and loads the next one. { TheLevelNumberVariableWithADescriptiveNameThatIsWithTheOtherVariables++; MediaPlayer.Stop(); MediaPlayer.Play(marioTheme); List <String[]> map = LevelLoader.Instance.loadLevel(LevelChanger()); castle = LevelFactory.Instance.CreateCastle(BackgroundCreator.LoadCastle()); CurrentState = new PlayGameState(this, this.GraphicsDevice); camera = new Camera(); Character.ChangeLevel(marioStartPosition); hud.setWorld(TheLevelNumberVariableWithADescriptiveNameThatIsWithTheOtherVariables); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); //Set up HUD hud.LoadFont(Content); hud.setWorld(TheLevelNumberVariableWithADescriptiveNameThatIsWithTheOtherVariables); hud.setTotalLevel(LevelFile.Length); //Load first level List <String[]> map = LevelLoader.Instance.loadLevel(this.LevelChanger()); //Load all factory resources SoundEffectFactory.Instance.LoadAllSoundEffects(Content); MarioFactory.Instance.LoadAllTextures(Content); ItemFactory.Instance.LoadAllTextures(Content); HiddenLevelItemFactory.Instance.LoadAllTextures(Content); ObjectFactory.Instance.LoadAllTextures(Content); EnemyFactory.Instance.LoadAllTextures(Content); ProjectileFactory.Instance.LoadAllTextures(Content); LevelFactory.Instance.LoadAllTextures(Content); ZombieFactory.Instance.LoadAllTextures(Content); NightmareEnemyFactory.Instance.LoadAllTextures(Content); //Setup music marioTheme = Content.Load <Song>("smbMarioGameTheme"); nightmareTheme = Content.Load <Song>("nightmareHalloweenTheme"); nightmareGameOver = Content.Load <Song>("nightmareSawThemeGameOver"); nightmareThemeIsStarted = false; //Prep first menu MediaPlayer.IsRepeating = true; menuItems = LevelFactory.Instance.GetMenuItems(); bg = new Scrolling(Content, new Rectangle(0, 0, 800, 512)); Character = new Mario(marioStartPosition, this); castle = LevelFactory.Instance.CreateCastle(BackgroundCreator.LoadCastle()); //Background elements// background = Content.Load <Texture2D>("background"); }