public override void Update(GameTime gameTime) { try { if (MediaPlayer.Queue.ActiveSong != song) { MediaPlayer.Play(song); MediaPlayer.IsRepeating = true; MediaPlayer.Volume = 1; } } catch (Exception) { } menu.Update(gameTime, Keyboard.GetState()); if (!menu.IsFinished) return; string selectedOption = options[menu.SelectedOption]; if (selectedOption == "New Game") { //dungeon_1 Flags.SetAllFlags(new Dictionary<string, bool>()); var player = new Player(game, 1, 9); var map = new DrawableMap(game); map.LoadMap("dungeon_1.js"); StateManager.PushState(new Overworld(game, player, map)); StateManager.PushState(new Dialogue(game, "Jordan: ...Ugh... (Wh... where am I...? So... hungry...)|???: <What? How are you still conscious?!>|Jordan: (Woah! Where is that voice coming from?!)|???: <You've been lying here without food for a week! I was sure you'd be dead by now!!>|Jordan: W-who's there?|Ludovic: <I'm Ludovic, a demon, and I've taken over your body. I kind of was hoping you were a bit more DEAD, though...>|Jordan: Gee, thanks...|Ludovic: <You don't have to talk aloud, you know. I can hear your thoughts. Plus, you're making that guard over there suspicious. Anyway, we have to get out of this castle.>|Jordan: (What is going on here?!)")); } else if (selectedOption == "Load Game") { object[] saveFile = GameData.Load(); if (saveFile == null) { StateManager.PushState(new Dialogue(game, "Save file could not be loaded.")); return; } var player = (Player)saveFile[0]; player.LoadTexture(game); Flags.SetAllFlags((Dictionary<string, bool>)saveFile[2]); var map = new DrawableMap(game); map.LoadMap((string)saveFile[1]); StateManager.PushState(new Overworld(game, player, map)); } else if (selectedOption == "About") { StateManager.PushState(new AboutState(game)); } else if (selectedOption == "Exit") StateManager.PopState(); }
public TestMapState(Game game) : base(game) { map = new DrawableMap(game); map.LoadMap("testmap.js"); }