protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); levelTextureHandler = new ContentManager(this.Services, "Content"); font = Content.Load<SpriteFont>("font"); #region Load angel angelNormalTexture[0] = Content.Load<Texture2D>("angel/angel normal 1"); angelNormalTexture[1] = Content.Load<Texture2D>("angel/angel normal 2"); angelFlyTexture[0] = Content.Load<Texture2D>("angel/angel fly 1"); angelFlyTexture[1] = Content.Load<Texture2D>("angel/angel fly 2"); angelFlyTexture[2] = Content.Load<Texture2D>("angel/angel fly 3"); #endregion #region Load cat catNormalTexture[0] = catNormalTexture[6] = Content.Load<Texture2D>("cat/cat normal 1"); catNormalTexture[1] = catNormalTexture[5] = Content.Load<Texture2D>("cat/cat normal 2"); catNormalTexture[2] = catNormalTexture[4] = Content.Load<Texture2D>("cat/cat normal 3"); catNormalTexture[3] = Content.Load<Texture2D>("cat/cat normal 4"); catHitTexture[0] = catHitTexture[4] = Content.Load<Texture2D>("cat/cat hit 1"); catHitTexture[1] = catHitTexture[3] = Content.Load<Texture2D>("cat/cat hit 2"); catHitTexture[2] = Content.Load<Texture2D>("cat/cat hit 3"); catHitTexture[5] = catHitTexture[7] = Content.Load<Texture2D>("cat/cat hit 4"); catHitTexture[6] = Content.Load<Texture2D>("cat/cat hit 5"); #endregion #region Load objects gemTexture = Content.Load<Texture2D>("objects/gem"); pixel = Content.Load<Texture2D>("pixel"); explosionTexture = Content.Load<Texture2D>("objects/explosion particle"); Texture2D[] fenceTexture = new Texture2D[1]; fenceTexture[0] = Content.Load<Texture2D>("pixel"); obTextures.Add("fence", fenceTexture); Texture2D[] rockTexture = new Texture2D[1]; rockTexture[0] = Content.Load<Texture2D>("objects/rock"); obTextures.Add("rock", rockTexture); Texture2D[] buttonTexture = new Texture2D[1]; buttonTexture[0] = Content.Load<Texture2D>("objects/button"); obTextures.Add("button", buttonTexture); Texture2D[] timeFrontTexture = new Texture2D[1]; timeFrontTexture[0] = Content.Load<Texture2D>("objects/timer front"); obTextures.Add("timefront", timeFrontTexture); Texture2D[] timeBackTexture = new Texture2D[1]; timeBackTexture[0] = Content.Load<Texture2D>("objects/timer back"); obTextures.Add("timeback", timeBackTexture); Texture2D[] plasmaTexture = new Texture2D[3]; plasmaTexture[0] = Content.Load<Texture2D>("objects/plasma ball 1"); plasmaTexture[1] = Content.Load<Texture2D>("objects/plasma ball 2"); plasmaTexture[2] = Content.Load<Texture2D>("objects/plasma ball 3"); obTextures.Add("plasma", plasmaTexture); Texture2D[] rocketTexture = new Texture2D[1]; rocketTexture[0] = Content.Load<Texture2D>("objects/rocket"); obTextures.Add("rocket", rocketTexture); Texture2D[] launcherTexture = new Texture2D[1]; launcherTexture[0] = Content.Load<Texture2D>("objects/launcher"); obTextures.Add("launcher", launcherTexture); Texture2D[] trailTexture = new Texture2D[1]; trailTexture[0] = explosionTexture; obTextures.Add("trail", trailTexture); Texture2D[] bubbleTexture = new Texture2D[1]; bubbleTexture[0] = explosionTexture; obTextures.Add("bubble", bubbleTexture); Texture2D[] starTexture = new Texture2D[1]; starTexture[0] = Content.Load<Texture2D>("objects/starfish"); obTextures.Add("starfish", starTexture); Texture2D[] fishTexture = new Texture2D[2]; fishTexture[0] = Content.Load<Texture2D>("objects/fish 1"); fishTexture[1] = Content.Load<Texture2D>("objects/fish 2"); obTextures.Add("fish", fishTexture); #endregion #region Load music canyonSong = Content.Load<Song>("canyonmus"); caveSong = Content.Load<Song>("cavemus"); labSong = Content.Load<Song>("labmus"); warSong = Content.Load<Song>("warmus"); waterSong = Content.Load<Song>("watermus"); finalSong = Content.Load<Song>("finalmus"); #endregion #region Load sounds hitWall = Content.Load<SoundEffect>("thump"); flap = Content.Load<SoundEffect>("whoosh"); meow = Content.Load<SoundEffect>("meow"); explode = Content.Load<SoundEffect>("explosion"); die = Content.Load<SoundEffect>("dead"); getGem = Content.Load<SoundEffect>("get gem"); ticking = Content.Load<SoundEffect>("ticking"); loopTick = ticking.CreateInstance(); loopTick.IsLooped = true; loopTick.Volume = 0.25f; rocketLaunch = Content.Load<SoundEffect>("rocket launch"); creditsMus = Content.Load<SoundEffect>("credits"); #endregion #region Load easter egg easterEgg = Content.Load<Video>("easter egg"); videoPlayer.IsLooped = true; videoPlayer.Volume = 1.0f; #endregion #region Instantiate cats HUDCat = new Cat(Vector2.Zero, -1, null, new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[0] = new Cat(Vector2.Zero, 0, "Welcome to Cat Planet 2!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[1] = new Cat(Vector2.Zero, 1, "Double the cat planet!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[2] = new Cat(Vector2.Zero, 2, "I'm lost :(", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[3] = new Cat(Vector2.Zero, 3, "Explore more Cat Planet!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[4] = new Cat(Vector2.Zero, 4, "Cat Village was destroyed by the crows!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[5] = new Cat(Vector2.Zero, 5, "So we moved here!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[6] = new Cat(Vector2.Zero, 6, "Cat Planet Canyon Planet!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[7] = new Cat(Vector2.Zero, 7, "Find all of the gems of light!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[8] = new Cat(Vector2.Zero, 8, "Uncover the secrets of Cat Planet!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[9] = new Cat(Vector2.Zero, 9, "You need to collect the gems to\n" + " prove yourself!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[10] = new Cat(Vector2.Zero, 10, "Our friend is gone!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[11] = new Cat(Vector2.Zero, 11, "He went up and never came back!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[12] = new Cat(Vector2.Zero, 12, "These caves are scary!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[13] = new Cat(Vector2.Zero, 13, "I'm in a ditch.", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[14] = new Cat(Vector2.Zero, 14, "The gem is close by!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[15] = new Cat(Vector2.Zero, 15, "It's left from here.", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[16] = new Cat(Vector2.Zero, 16, "It's down there!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[17] = new Cat(Vector2.Zero, 17, "Did you get the gem?", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[18] = new Cat(Vector2.Zero, 18, "I wasn't in the first game!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[19] = new Cat(Vector2.Zero, 19, "The fish are evil!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[20] = new Cat(Vector2.Zero, 20, "There's more danger past these spikes!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[21] = new Cat(Vector2.Zero, 21, "There's a secret close by.", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[22] = new Cat(Vector2.Zero, 22, "I don't know where these rocks\n" + " are coming from!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[23] = new Cat(Vector2.Zero, 23, "The fish have made Cat Planet\n" + " a dangerous place!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[24] = new Cat(Vector2.Zero, 24, "War is not the answer!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[25] = new Cat(Vector2.Zero, 25, "Cat!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[26] = new Cat(Vector2.Zero, 26, "Pla!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[27] = new Cat(Vector2.Zero, 27, "Net!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[28] = new Cat(Vector2.Zero, 28, "Help!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[29] = new Cat(Vector2.Zero, 29, "Up there is a war zone!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[30] = new Cat(Vector2.Zero, 30, "Spinning plasma of doom!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[31] = new Cat(Vector2.Zero, 31, "Obviously work of the fish!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[32] = new Cat(Vector2.Zero, 32, "The gem!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[33] = new Cat(Vector2.Zero, 33, "Be careful here!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[34] = new Cat(Vector2.Zero, 34, "The cat below me is lying!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[35] = new Cat(Vector2.Zero, 35, "The bottom cat is\n" + "telling the truth!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[36] = new Cat(Vector2.Zero, 36, "I'm lying!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[37] = new Cat(Vector2.Zero, 37, "The first cat is the same\n" + " as the one above me!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[38] = new Cat(Vector2.Zero, 38, "Those rocket launchers are\n" + " dangerous!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[39] = new Cat(Vector2.Zero, 39, "Explosions are cool!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[40] = new Cat(Vector2.Zero, 40, "More rocks!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[41] = new Cat(Vector2.Zero, 41, " The crows are no more,\n" + "but the fish are much worse.", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[42] = new Cat(Vector2.Zero, 42, "So much destruction!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[43] = new Cat(Vector2.Zero, 43, "We're losing!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[44] = new Cat(Vector2.Zero, 44, "The gem here is well\n" + " protected!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[45] = new Cat(Vector2.Zero, 45, "My friend is trapped!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[46] = new Cat(Vector2.Zero, 46, "I'm actually safe from\n" + " the rockets up here!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[47] = new Cat(Vector2.Zero, 47, "Reminds me of 'Nam.", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[48] = new Cat(Vector2.Zero, 48, "I think that's what we're\n" + " fighting over...", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[49] = new Cat(Vector2.Zero, 49, "They're everywhere!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[50] = new Cat(Vector2.Zero, 50, "Imperialist fish!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[51] = new Cat(Vector2.Zero, 51, "We're underwater!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[52] = new Cat(Vector2.Zero, 52, "Cat Planet Ocean!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[53] = new Cat(Vector2.Zero, 53, "The bubbles carry\n" + " you places!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[54] = new Cat(Vector2.Zero, 54, "Cats don't like water!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[55] = new Cat(Vector2.Zero, 55, "BUBBLES!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[56] = new Cat(Vector2.Zero, 56, "Time it right!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[57] = new Cat(Vector2.Zero, 57, "Starfish are dangerous!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[58] = new Cat(Vector2.Zero, 58, "But they're nothing \n" + " compared to the\n" + " fish!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[59] = new Cat(Vector2.Zero, 59, "You're close to the\n" + " final struggle!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[60] = new Cat(Vector2.Zero, 60, "You need all the gems\n" + "of light to continue!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[61] = new Cat(Vector2.Zero, 61, " Do you have 62 cats?\n" + "There's no turning back.", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[62] = new Cat(Vector2.Zero, 62, "It's the fish!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[63] = new Cat(Vector2.Zero, 63, "The fish are dangerous!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[64] = new Cat(Vector2.Zero, 64, "Keep going!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[65] = new Cat(Vector2.Zero, 65, "You're getting close!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[66] = new Cat(Vector2.Zero, 66, "You have to go up!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[67] = new Cat(Vector2.Zero, 67, "You did it!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); #endregion #region Instantiate gems gems[0] = new Gem(Vector2.Zero, gemTexture, Color.Cyan); gems[1] = new Gem(Vector2.Zero, gemTexture, Color.Lime); gems[2] = new Gem(Vector2.Zero, gemTexture, Color.Red); gems[3] = new Gem(Vector2.Zero, gemTexture, Color.Yellow); gems[4] = new Gem(Vector2.Zero, gemTexture, Color.Violet); #endregion #region Instantiate final fences finalFences[0] = new ElectricFence(new Rectangle(319, 478, 349, 32), obTextures["fence"][0], Color.Cyan, 0); finalFences[1] = new ElectricFence(new Rectangle(319, 527, 349, 32), obTextures["fence"][0], Color.Lime, 1); finalFences[2] = new ElectricFence(new Rectangle(319, 576, 349, 32), obTextures["fence"][0], Color.Red, 2); finalFences[3] = new ElectricFence(new Rectangle(319, 625, 349, 32), obTextures["fence"][0], Color.Yellow, 3); finalFences[4] = new ElectricFence(new Rectangle(319, 674, 349, 32), obTextures["fence"][0], Color.Violet, 4); #endregion StreamReader sr = new StreamReader("Content/levels/11-0.txt"); levels[11, 0] = new Level(sr, new Vector2(11, 0), Level.Type.Canyons, Content.Load<Texture2D>("backdrops/canyons"), levelTextureHandler.Load<Texture2D>("foregrounds/11-0"), cats, gems, obTextures); sr.Close(); sr = new StreamReader("Content/levels/10-0.txt"); levels[10, 0] = new Level(sr, new Vector2(10, 0), Level.Type.Canyons, Content.Load<Texture2D>("backdrops/canyons"), levelTextureHandler.Load<Texture2D>("foregrounds/10-0"), cats, gems, obTextures); sr.Close(); sr = new StreamReader("Content/levels/0-0.txt"); levels[0, 0] = new Level(sr, new Vector2(0, 0), Level.Type.Final, Content.Load<Texture2D>("backdrops/final"), levelTextureHandler.Load<Texture2D>("pixel"), cats, gems, obTextures); sr.Close(); sr.Dispose(); currentLevel = levels[11, 0]; previousLevel = levels[10, 0]; LoadLevels(); angel = new Angel(angelNormalTexture, angelFlyTexture, hitWall, flap, new Vector2(windowWidth / 2, 459)); MediaPlayer.Volume = 0.85f; MediaPlayer.IsRepeating = true; ChangeSong(); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load<SpriteFont>("font"); // Load sprites angelNormalTexture[0] = Content.Load<Texture2D>("angel/angel normal 1"); angelNormalTexture[1] = Content.Load<Texture2D>("angel/angel normal 2"); angelFlyTexture[0] = Content.Load<Texture2D>("angel/angel fly 1"); angelFlyTexture[1] = Content.Load<Texture2D>("angel/angel fly 2"); angelFlyTexture[2] = Content.Load<Texture2D>("angel/angel fly 3"); catNormalTexture[0] = catNormalTexture[6] = Content.Load<Texture2D>("cat/cat normal 1"); catNormalTexture[1] = catNormalTexture[5] = Content.Load<Texture2D>("cat/cat normal 2"); catNormalTexture[2] = catNormalTexture[4] = Content.Load<Texture2D>("cat/cat normal 3"); catNormalTexture[3] = Content.Load<Texture2D>("cat/cat normal 4"); catHitTexture[0] = catHitTexture[4] = Content.Load<Texture2D>("cat/cat hit 1"); catHitTexture[1] = catHitTexture[3] = Content.Load<Texture2D>("cat/cat hit 2"); catHitTexture[2] = Content.Load<Texture2D>("cat/cat hit 3"); catHitTexture[5] = catHitTexture[7] = Content.Load<Texture2D>("cat/cat hit 4"); catHitTexture[6] = Content.Load<Texture2D>("cat/cat hit 5"); gemTexture = Content.Load<Texture2D>("gem"); explosionTexture = Content.Load<Texture2D>("explosion particle"); // Load backgrounds backgrounds[0] = Content.Load<Texture2D>("backdrops/canyons"); backgrounds[2] = Content.Load<Texture2D>("backdrops/caves"); backgrounds[3] = Content.Load<Texture2D>("backdrops/warzone"); //backgrounds[4] = Content.Load<Texture2D>("backdrops/lab"); backgrounds[5] = Content.Load<Texture2D>("backdrops/underwater"); backgrounds[6] = Content.Load<Texture2D>("backdrops/underwater transition"); //backgrounds[7] = Content.Load<Texture2D>("backdrops/final"); // Load sounds and music hitWall = Content.Load<SoundEffect>("thump"); flap = Content.Load<SoundEffect>("whoosh"); meow = Content.Load<SoundEffect>("meow"); // Load cats HUDCat = new Cat(Vector2.Zero, -1, null, new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[0] = new Cat(Vector2.Zero, 0, "Welcome to Cat Planet 2!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[1] = new Cat(Vector2.Zero, 1, "Double the cat planet!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[2] = new Cat(Vector2.Zero, 2, "I'm lost :(", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[3] = new Cat(Vector2.Zero, 3, "Explore more Cat Planet!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[4] = new Cat(Vector2.Zero, 4, "Cat Village was destroyed by the crows!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[5] = new Cat(Vector2.Zero, 5, "So we moved here!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[6] = new Cat(Vector2.Zero, 6, "Cat Planet Canyon Planet!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[7] = new Cat(Vector2.Zero, 7, "Find all of the gems of light!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[8] = new Cat(Vector2.Zero, 8, "Uncover the secrets of Cat Planet!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[9] = new Cat(Vector2.Zero, 9, "You need to collect the gems to\n" + " prove yourself!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[10] = new Cat(Vector2.Zero, 10, "Our friend is gone!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); cats[11] = new Cat(Vector2.Zero, 11, "He went up and never came back!", new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font); // Load gems gems[0] = new Gem(Vector2.Zero, gemTexture, Color.Cyan); gems[1] = new Gem(Vector2.Zero, gemTexture, Color.Lime); gems[2] = new Gem(Vector2.Zero, gemTexture, Color.Red); gems[3] = new Gem(Vector2.Zero, gemTexture, Color.Yellow); gems[4] = new Gem(Vector2.Zero, gemTexture, Color.Violet); // Load levels StreamReader sr = new StreamReader("Content/levels.txt"); levels[9, 0] = new Level(sr, new Vector2(9, 0), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/9-0"), cats, gems, obTextures); levels[9, 1] = new Level(sr, new Vector2(9, 1), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/9-1"), cats, gems, obTextures); levels[9, 2] = new Level(sr, new Vector2(9, 2), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/9-2"), cats, gems, obTextures); levels[9, 3] = new Level(sr, new Vector2(9, 3), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/9-3"), cats, gems, obTextures); levels[9, 4] = new Level(sr, new Vector2(9, 4), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/9-4"), cats, gems, obTextures); levels[10, 0] = new Level(sr, new Vector2(10, 0), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/10-0"), cats, gems, obTextures); levels[10, 1] = new Level(sr, new Vector2(10, 1), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/10-1"), cats, gems, obTextures); levels[10, 2] = new Level(sr, new Vector2(10, 2), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/10-2"), cats, gems, obTextures); levels[10, 3] = new Level(sr, new Vector2(10, 3), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/10-3"), cats, gems, obTextures); levels[10, 4] = new Level(sr, new Vector2(10, 4), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/10-4"), cats, gems, obTextures); levels[11, 0] = new Level(sr, new Vector2(11, 0), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-0"), cats, gems, obTextures); levels[11, 1] = new Level(sr, new Vector2(11, 1), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-1"), cats, gems, obTextures); levels[11, 2] = new Level(sr, new Vector2(11, 2), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-2"), cats, gems, obTextures); levels[11, 3] = new Level(sr, new Vector2(11, 3), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-3"), cats, gems, obTextures); levels[11, 4] = new Level(sr, new Vector2(11, 4), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-4"), cats, gems, obTextures); currentLevel = levels[11, 0]; previousLevel = levels[10, 0]; angel = new Angel(angelNormalTexture, angelFlyTexture, hitWall, flap, new Vector2(windowWidth / 2, windowHeight - 128)); }
public Level(StreamReader sr, Vector2 coordinates, Type type, Texture2D back, Texture2D fore, Cat[] cArray, Gem[] gArray, Dictionary<string, Texture2D[]> obTextures) { this.coordinates = coordinates; walls = new List<Wall>(); cats = new List<Cat>(); links = new List<Link>(); deathWalls = new List<DeathWall>(); rocks = new List<FallingRock>(); fences = new List<ElectricFence>(); buttons = new List<Button>(); timers = new List<Timer>(); plasmas = new List<SpinningPlasma>(); launchers = new List<RocketLauncher>(); bubbles = new List<Bubbles>(); starfish = new List<Starfish>(); fish = new List<Fish>(); colors = new Dictionary<string, Color>(); colors.Add("red", Color.Red); colors.Add("orange", Color.Orange); colors.Add("yellow", Color.Yellow); colors.Add("lime", Color.Lime); colors.Add("cyan", Color.Cyan); colors.Add("purple", Color.Purple); string line = ""; /************************************************************************************************** * Format of text file: * # # Specifies the coordinates of the board in the world * restart [#ofpositions lfromx lfromy x y lfromx lfromy x y... etc] * wall [posx posy width heigh] * obstaclewall [posx posy width height] * cat [posx posy index] * gem [posx posy index] * link [posx posy width height leveltox leveltoy flipx? flipy?] * deathwall [posx posy width height] * rock [posx posy speedx speedy] * fence [posx posy width height color index] * button [posx posy color index] * timer [posx posy index time loop?] // make radius in multiples of 3 * plasma [posx posy radius counterclockwise?] * launcher [posx posy] * bubbles [posx posy width height speedx speedy] * starfish [posx posy speedx speedy] * fish [posx posy] * ! Denotes end of board **************************************************************************************************/ while (!sr.EndOfStream) { line = sr.ReadLine(); if (line != null) { string[] splitLine = line.Trim().Split(' '); if (splitLine[0] == "restart") { restartPosition = new Dictionary<Vector2, Vector2>(int.Parse(splitLine[1])); for (int i = 2; i < splitLine.Length; i += 4) restartPosition[new Vector2(int.Parse(splitLine[i]), int.Parse(splitLine[i + 1]))] = new Vector2(int.Parse(splitLine[i + 2]), int.Parse(splitLine[i + 3])); } else if (splitLine[0] == "wall") walls.Add(new Wall(new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), int.Parse(splitLine[3]), int.Parse(splitLine[4])))); else if (splitLine[0] == "cat") { cArray[int.Parse(splitLine[3])].position = new Vector2(int.Parse(splitLine[1]), int.Parse(splitLine[2])); cArray[int.Parse(splitLine[3])].UpdateHitBox(); this.cats.Add(cArray[int.Parse(splitLine[3])]); } else if (splitLine[0] == "gem") { gArray[int.Parse(splitLine[3])].position = new Vector2(int.Parse(splitLine[1]), int.Parse(splitLine[2])); gem = gArray[int.Parse(splitLine[3])]; } else if (splitLine[0] == "link") { links.Add(new Link(new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), int.Parse(splitLine[3]), int.Parse(splitLine[4])), new Vector2(int.Parse(splitLine[5]), int.Parse(splitLine[6])), (int.Parse(splitLine[7]) == 1 ? true : false), (int.Parse(splitLine[8]) == 1 ? true : false))); } else if (splitLine[0] == "deathwall") { deathWalls.Add(new DeathWall(new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), int.Parse(splitLine[3]), int.Parse(splitLine[4])))); } else if (splitLine[0] == "obstaclewall") { walls.Add(new ObstacleWall(new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), int.Parse(splitLine[3]), int.Parse(splitLine[4])))); } else if (splitLine[0] == "fence") { fences.Insert(int.Parse(splitLine[6]), new ElectricFence(new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), int.Parse(splitLine[3]), int.Parse(splitLine[4])), obTextures["fence"][0], colors[splitLine[5]], int.Parse(splitLine[6]))); } else if (splitLine[0] == "rock") { rocks.Add(new FallingRock(obTextures["rock"][0], new Vector2(int.Parse(splitLine[1]), int.Parse(splitLine[2])), new Vector2(int.Parse(splitLine[3]), int.Parse(splitLine[4])), new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), 64, 64))); } else if (splitLine[0] == "button") { buttons.Insert(int.Parse(splitLine[4]), new Button(obTextures["button"][0], new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), 32, 32), colors[splitLine[3]], int.Parse(splitLine[4]))); } else if (splitLine[0] == "timer") { timers.Insert(int.Parse(splitLine[3]), new Timer(obTextures["timefront"][0], obTextures["timeback"][0], new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), 48, 48), int.Parse(splitLine[3]), int.Parse(splitLine[4]), int.Parse(splitLine[5]) == 1)); } else if (splitLine[0] == "plasma") { plasmas.Add(new SpinningPlasma(new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), 32, 32), int.Parse(splitLine[3]), float.Parse(splitLine[4]), splitLine[5] == "1", new AnimatedTexture(obTextures["plasma"], 1, false))); } else if (splitLine[0] == "launcher") { launchers.Add(new RocketLauncher(new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), 48, 48), obTextures["launcher"][0], obTextures["rocket"][0], obTextures["trail"][0])); } else if (splitLine[0] == "bubbles") { bubbles.Add(new Bubbles(new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), int.Parse(splitLine[3]), int.Parse(splitLine[4])), new Vector2(int.Parse(splitLine[5]), int.Parse(splitLine[6])), obTextures["bubble"][0])); } else if (splitLine[0] == "starfish") { starfish.Add(new Starfish(new Rectangle(int.Parse(splitLine[1]), int.Parse(splitLine[2]), 64, 64), new Vector2(int.Parse(splitLine[3]), int.Parse(splitLine[4])), obTextures["starfish"][0])); } else if (splitLine[0] == "fish") { fish.Add(new Fish(new Vector2(int.Parse(splitLine[1]), int.Parse(splitLine[2])), new AnimatedTexture(obTextures["fish"], 10, false))); } } } this.back = back; this.fore = fore; this.type = type; }