/// <summary>
 /// Win Screen Text
 /// </summary>
 /// <param name="spriteBatch">sprite batch used to draw text</param>
 /// <param name="fontDict">dictonary of fonts, key required to access different fonts</param>
 public void WinScreen(SpriteBatch spriteBatch, Dictionary<string, SpriteFont> fontDict, Sloth slothClass)
 {
     spriteBatch.DrawString(fontDict["Title"], "You made it home!", new Vector2(180, 50), Color.Black);
     spriteBatch.DrawString(fontDict["Small"], "Press A to begin the adventure again", new Vector2(480, 420), Color.Coral);
     spriteBatch.DrawString(fontDict["Small"], "Final Health: " + slothClass.Health, new Vector2(20, 360), Color.Black);
     spriteBatch.DrawString(fontDict["Small"], "Final Claw Sharpness: " + slothClass.Attack, new Vector2(20, 380), Color.Black);
     spriteBatch.DrawString(fontDict["Small"], "Final Experience: " + slothClass.Experience, new Vector2(20, 400), Color.Black);
 }
 public void Stats(SpriteBatch spriteBatch, Dictionary<string, SpriteFont> fontDict, Sloth slothClass, Room roomClass)
 {
     // Displaying Sloth Attributes (Health, Attack, Room#, Experience)
     spriteBatch.DrawString(fontDict["Small"], "Health: " + slothClass.Health, new Vector2(20, 20), Color.Crimson);
     spriteBatch.DrawString(fontDict["Small"], "Claw Sharpness: " + slothClass.Attack, new Vector2(20, 40), Color.BurlyWood);
     spriteBatch.DrawString(fontDict["Small"], "Room Number: " + (roomClass.RoomNumber + 1), new Vector2(20, 60), Color.Ivory);
     spriteBatch.DrawString(fontDict["Small"], "Experience: " + slothClass.Experience, new Vector2(20, 80), Color.Gainsboro);
 }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            #region Dictonary Loading

            // Loads all sprites into their respective dictonary keys
            spriteDict.Add("darkJungle", Content.Load <Texture2D>("Sprites\\Backgrounds\\darkJungle"));
            spriteDict.Add("gameOver", Content.Load <Texture2D>("Sprites\\Backgrounds\\gameOver"));
            spriteDict.Add("winScreen", Content.Load <Texture2D>("Sprites\\Backgrounds\\winScreen"));
            spriteDict.Add("greenJungle", Content.Load <Texture2D>("Sprites\\Backgrounds\\greenJungle"));
            spriteDict.Add("infoScreen", Content.Load <Texture2D>("Sprites\\Backgrounds\\infoScreen"));
            spriteDict.Add("jungleTree", Content.Load <Texture2D>("Sprites\\Backgrounds\\jungleTree"));
            spriteDict.Add("smallTitle", Content.Load <Texture2D>("Sprites\\Backgrounds\\smallTitle"));
            spriteDict.Add("waterfall", Content.Load <Texture2D>("Sprites\\Backgrounds\\waterfall"));
            spriteDict.Add("jaguar", Content.Load <Texture2D>("Sprites\\Characters\\jaguarFinal"));
            spriteDict.Add("slothathor", Content.Load <Texture2D>("Sprites\\Characters\\finalSloth1"));
            spriteDict.Add("slothathorClaws", Content.Load <Texture2D>("Sprites\\Characters\\sloth2"));
            spriteDict.Add("slothathorDefend", Content.Load <Texture2D>("Sprites\\Characters\\slothathorDefend"));
            spriteDict.Add("flower", Content.Load <Texture2D>("Sprites\\Pickups\\smallFlower"));
            spriteDict.Add("leaf", Content.Load <Texture2D>("Sprites\\Pickups\\leafFinal"));
            spriteDict.Add("sharpeningRock", Content.Load <Texture2D>("Sprites\\Pickups\\rockFinal"));
            spriteDict.Add("zap", Content.Load <Texture2D>("Sprites\\Characters\\smallNet"));

            // Adds fonts to their keys
            fontDict.Add("Medium", Content.Load <SpriteFont>("Fonts\\MediumFont"));
            fontDict.Add("Small", Content.Load <SpriteFont>("Fonts\\SmallFont"));
            fontDict.Add("Title", Content.Load <SpriteFont>("Fonts\\TitleFont"));

            // Adds sounds to their keys
            soundDict.Add("intro", Content.Load <SoundEffect>("Sounds\\beginningGame"));
            soundDict.Add("jaguarCry", Content.Load <SoundEffect>("Sounds\\jaguarCry"));
            soundDict.Add("leafCrunch", Content.Load <SoundEffect>("Sounds\\leafCrunch"));
            soundDict.Add("rockScrape", Content.Load <SoundEffect>("Sounds\\rockScrape"));
            soundDict.Add("netWoosh", Content.Load <SoundEffect>("Sounds\\netWoosh"));
            soundDict.Add("slothScratch", Content.Load <SoundEffect>("Sounds\\slothScratch"));

            // Populates arrays with new Rooms and Menus
            levels[0] = new Room(spriteDict["darkJungle"], viewPortRect, 0, 1, rand.Next(3), rand.Next(3), rand.Next(2), 1);
            levels[1] = new Room(spriteDict["greenJungle"], viewPortRect, 1, 1, rand.Next(4), rand.Next(2), rand.Next(2), 1);
            levels[2] = new Room(spriteDict["jungleTree"], viewPortRect, 2, 1, rand.Next(2), rand.Next(4), rand.Next(2), 1);
            levels[3] = new Room(spriteDict["waterfall"], viewPortRect, 3, 1, rand.Next(2), rand.Next(2), rand.Next(2), 1);
            menus[0]  = new Menu(spriteDict["smallTitle"], viewPortRect, 0);
            menus[1]  = new Menu(spriteDict["infoScreen"], viewPortRect, 1);
            menus[2]  = new Menu(spriteDict["gameOver"], viewPortRect, 2);
            menus[3]  = new Menu(spriteDict["winScreen"], viewPortRect, 2);
            fonts[0]  = fontDict["Medium"];
            fonts[1]  = fontDict["Title"];
            fonts[2]  = fontDict["Small"];


            #endregion

            menuOpen   = true;                                                                                                                         // initial screen will be the title screen (a menu)
            menuClass  = menus[0];                                                                                                                     // loads the first menu into the menu class
            roomClass  = levels[0];                                                                                                                    // load first level into the room class
            slothClass = new Sloth(spriteDict["slothathor"], spriteDict["slothathor"], spriteDict["slothathorClaws"], spriteDict["slothathorDefend"]); // loads all sloth sprites into sloth classes
            soundDict["intro"].Play(.25f, 0, 0);
        }
 /// <summary>
 /// Loads the game from the save file.
 /// </summary>
 public void LoadGame(Sloth slothClass)
 {
     TextReader XMLReader = new StreamReader("SlothSave.xml"); // creates new StreamReader which reads in the file path
     XmlSerializer deserializer = new XmlSerializer(typeof(SlothData));
     saveSlothData = (SlothData)deserializer.Deserialize(XMLReader);
     slothClass.Health = saveSlothData.health;
     slothClass.Attack = saveSlothData.attack;
     slothClass.Experience = saveSlothData.experience;
     slothClass.SpritePosition = saveSlothData.position;
     XMLReader.Close();
 }
        /// <summary>
        /// Loads the game from the save file.
        /// </summary>
        public void LoadGame(Sloth slothClass)
        {
            TextReader    XMLReader    = new StreamReader("SlothSave.xml"); // creates new StreamReader which reads in the file path
            XmlSerializer deserializer = new XmlSerializer(typeof(SlothData));

            saveSlothData             = (SlothData)deserializer.Deserialize(XMLReader);
            slothClass.Health         = saveSlothData.health;
            slothClass.Attack         = saveSlothData.attack;
            slothClass.Experience     = saveSlothData.experience;
            slothClass.SpritePosition = saveSlothData.position;
            XMLReader.Close();
        }
 /// <summary>
 /// Checks every frame for a new request to save
 /// </summary>
 public void Update(GameTime gameTime, Sloth slothClass)
 {
     if (slothSaveRequest)
     {
         SaveGame(slothClass);
         slothSaveRequest = false;
     }
     else if (slothLoadRequest)
     {
         LoadGame(slothClass);
         slothLoadRequest = false;
     }
 }
 /// <summary>
 /// Checks every frame for a new request to save
 /// </summary>
 public void Update(GameTime gameTime, Sloth slothClass)
 {
     if (slothSaveRequest)
     {
         SaveGame(slothClass);
         slothSaveRequest = false;
     }
     else if (slothLoadRequest)
     {
         LoadGame(slothClass);
         slothLoadRequest = false;
     }
 }
        /// <summary>
        /// Saves the game in the same directory as the executable.
        /// </summary>
        private void SaveGame(Sloth slothClass)
        {
            saveSlothData = new SlothData() // prime SaveData for saving game info
            {
                health = slothClass.Health,
                attack = slothClass.Attack,
                experience = slothClass.Experience,
                position = slothClass.SpritePosition
            };

            DeleteExisting(); // Deletes old files if they exist
            System.IO.StreamWriter file = new System.IO.StreamWriter("SlothSave.xml");
            XmlSerializer serializer = new XmlSerializer(typeof(SlothData));
            serializer.Serialize(file, saveSlothData);
            file.Close();
        }
        /// <summary>
        /// Saves the game in the same directory as the executable.
        /// </summary>
        private void SaveGame(Sloth slothClass)
        {
            saveSlothData = new SlothData() // prime SaveData for saving game info
            {
                health     = slothClass.Health,
                attack     = slothClass.Attack,
                experience = slothClass.Experience,
                position   = slothClass.SpritePosition
            };

            DeleteExisting(); // Deletes old files if they exist
            System.IO.StreamWriter file       = new System.IO.StreamWriter("SlothSave.xml");
            XmlSerializer          serializer = new XmlSerializer(typeof(SlothData));

            serializer.Serialize(file, saveSlothData);
            file.Close();
        }
Beispiel #10
0
 public void Stats(SpriteBatch spriteBatch, Dictionary <string, SpriteFont> fontDict, Sloth slothClass, Room roomClass)
 {
     // Displaying Sloth Attributes (Health, Attack, Room#, Experience)
     spriteBatch.DrawString(fontDict["Small"], "Health: " + slothClass.Health, new Vector2(20, 20), Color.Crimson);
     spriteBatch.DrawString(fontDict["Small"], "Claw Sharpness: " + slothClass.Attack, new Vector2(20, 40), Color.BurlyWood);
     spriteBatch.DrawString(fontDict["Small"], "Room Number: " + (roomClass.RoomNumber + 1), new Vector2(20, 60), Color.Ivory);
     spriteBatch.DrawString(fontDict["Small"], "Experience: " + slothClass.Experience, new Vector2(20, 80), Color.Gainsboro);
 }
Beispiel #11
0
 /// <summary>
 /// Win Screen Text
 /// </summary>
 /// <param name="spriteBatch">sprite batch used to draw text</param>
 /// <param name="fontDict">dictonary of fonts, key required to access different fonts</param>
 public void WinScreen(SpriteBatch spriteBatch, Dictionary <string, SpriteFont> fontDict, Sloth slothClass)
 {
     spriteBatch.DrawString(fontDict["Title"], "You made it home!", new Vector2(180, 50), Color.Black);
     spriteBatch.DrawString(fontDict["Small"], "Press A to begin the adventure again", new Vector2(480, 420), Color.Coral);
     spriteBatch.DrawString(fontDict["Small"], "Final Health: " + slothClass.Health, new Vector2(20, 360), Color.Black);
     spriteBatch.DrawString(fontDict["Small"], "Final Claw Sharpness: " + slothClass.Attack, new Vector2(20, 380), Color.Black);
     spriteBatch.DrawString(fontDict["Small"], "Final Experience: " + slothClass.Experience, new Vector2(20, 400), Color.Black);
 }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            #region Dictonary Loading

            // Loads all sprites into their respective dictonary keys
            spriteDict.Add("darkJungle", Content.Load<Texture2D>("Sprites\\Backgrounds\\darkJungle"));
            spriteDict.Add("gameOver", Content.Load<Texture2D>("Sprites\\Backgrounds\\gameOver"));
            spriteDict.Add("winScreen", Content.Load<Texture2D>("Sprites\\Backgrounds\\winScreen"));
            spriteDict.Add("greenJungle", Content.Load<Texture2D>("Sprites\\Backgrounds\\greenJungle"));
            spriteDict.Add("infoScreen", Content.Load<Texture2D>("Sprites\\Backgrounds\\infoScreen"));
            spriteDict.Add("jungleTree", Content.Load<Texture2D>("Sprites\\Backgrounds\\jungleTree"));
            spriteDict.Add("smallTitle", Content.Load<Texture2D>("Sprites\\Backgrounds\\smallTitle"));
            spriteDict.Add("waterfall", Content.Load<Texture2D>("Sprites\\Backgrounds\\waterfall"));
            spriteDict.Add("jaguar", Content.Load<Texture2D>("Sprites\\Characters\\jaguarFinal"));
            spriteDict.Add("slothathor", Content.Load<Texture2D>("Sprites\\Characters\\finalSloth1"));
            spriteDict.Add("slothathorClaws", Content.Load<Texture2D>("Sprites\\Characters\\sloth2"));
            spriteDict.Add("slothathorDefend", Content.Load<Texture2D>("Sprites\\Characters\\slothathorDefend"));
            spriteDict.Add("flower", Content.Load<Texture2D>("Sprites\\Pickups\\smallFlower"));
            spriteDict.Add("leaf", Content.Load<Texture2D>("Sprites\\Pickups\\leafFinal"));
            spriteDict.Add("sharpeningRock", Content.Load<Texture2D>("Sprites\\Pickups\\rockFinal"));
            spriteDict.Add("zap", Content.Load<Texture2D>("Sprites\\Characters\\smallNet"));

            // Adds fonts to their keys
            fontDict.Add("Medium", Content.Load<SpriteFont>("Fonts\\MediumFont"));
            fontDict.Add("Small", Content.Load<SpriteFont>("Fonts\\SmallFont"));
            fontDict.Add("Title", Content.Load<SpriteFont>("Fonts\\TitleFont"));

            // Adds sounds to their keys
            soundDict.Add("intro", Content.Load<SoundEffect>("Sounds\\beginningGame"));
            soundDict.Add("jaguarCry", Content.Load<SoundEffect>("Sounds\\jaguarCry"));
            soundDict.Add("leafCrunch", Content.Load<SoundEffect>("Sounds\\leafCrunch"));
            soundDict.Add("rockScrape", Content.Load<SoundEffect>("Sounds\\rockScrape"));
            soundDict.Add("netWoosh", Content.Load<SoundEffect>("Sounds\\netWoosh"));
            soundDict.Add("slothScratch", Content.Load<SoundEffect>("Sounds\\slothScratch"));

            // Populates arrays with new Rooms and Menus
            levels[0] = new Room(spriteDict["darkJungle"], viewPortRect, 0, 1, rand.Next(3), rand.Next(3), rand.Next(2), 1);
            levels[1] = new Room(spriteDict["greenJungle"], viewPortRect, 1, 1, rand.Next(4), rand.Next(2), rand.Next(2), 1);
            levels[2] = new Room(spriteDict["jungleTree"], viewPortRect, 2, 1, rand.Next(2), rand.Next(4), rand.Next(2), 1);
            levels[3] = new Room(spriteDict["waterfall"], viewPortRect, 3, 1, rand.Next(2), rand.Next(2), rand.Next(2), 1);
            menus[0] = new Menu(spriteDict["smallTitle"], viewPortRect, 0);
            menus[1] = new Menu(spriteDict["infoScreen"], viewPortRect, 1);
            menus[2] = new Menu(spriteDict["gameOver"], viewPortRect, 2);
            menus[3] = new Menu(spriteDict["winScreen"], viewPortRect, 2);
            fonts[0] = fontDict["Medium"];
            fonts[1] = fontDict["Title"];
            fonts[2] = fontDict["Small"];

            #endregion

            menuOpen = true; // initial screen will be the title screen (a menu)
            menuClass = menus[0]; // loads the first menu into the menu class
            roomClass = levels[0]; // load first level into the room class
            slothClass = new Sloth(spriteDict["slothathor"], spriteDict["slothathor"], spriteDict["slothathorClaws"], spriteDict["slothathorDefend"]); // loads all sloth sprites into sloth classes
            soundDict["intro"].Play(.25f,0,0);
        }