/// <summary> /// load assets /// </summary> public override void LoadContent() { SoundManager.PlaySong("Credits", true); belowLogo = ImageTools.LoadTexture2D("Graphics/Logos/below_logo"); belowVector = ImageTools.CenterImage_vect(belowLogo); sharkboyLogo = ImageTools.LoadTexture2D("Graphics/Logos/sharkboylogo"); sharkVector = new Vector2(ImageTools.CenterImage_vect(sharkboyLogo).X, 1400); cogThoughtLogo = ImageTools.LoadTexture2D("Graphics/Logos/cognitive"); cogVector = new Vector2(ImageTools.CenterImage(cogThoughtLogo).X, 3100); hv1 = new Vector2(TextTools.CenterText(ScreenManager.MediumFont, h1).X, 5000); hv2 = new Vector2(TextTools.CenterText(ScreenManager.SmallFont, h2).X, 5070); av1 = new Vector2(TextTools.CenterText(ScreenManager.MediumFont, a1).X, 6000); av2 = new Vector2(TextTools.CenterText(ScreenManager.SmallFont, a2).X, 6070); dv1 = new Vector2(TextTools.CenterText(ScreenManager.MediumFont, d1).X, 7000); dv2 = new Vector2(TextTools.CenterText(ScreenManager.SmallFont, d2).X, 7070); sv1 = new Vector2(TextTools.CenterText(ScreenManager.MediumFont, s1).X, 8000); sv2 = new Vector2(TextTools.CenterText(ScreenManager.SmallFont, s2).X, 8070); cv1 = new Vector2(TextTools.CenterText(ScreenManager.SmallFont, c1).X, 9000); cv2 = new Vector2(TextTools.CenterText(ScreenManager.SmallFont, c2).X, 9070); base.LoadContent(); }
/// <summary> /// load game content /// </summary> public override void LoadContent() { Pausable = true; ScreenOrder.SaveScreen(this); SoundManager.PlaySong("Forest", true); SoundManager.AddLoopingSound("rainlong", .05f); level = new Level("Levels/forest.bmp"); level.TileSetRow = 0; level.LoadLevel(); level.CamType = "center"; cave = ImageTools.LoadTexture2D("Graphics/Misc/cave"); caveBounds = new Rectangle(4541, 512 - 64, 32 * 4, 64 * 2); storm = new ThunderStorm(); background = new ParallaxBackground(ImageTools.LoadTexture2D("Graphics/Backgrounds/sun_background"), ImageTools.LoadTexture2D("Graphics/Backgrounds/mountains_parallax"), ImageTools.LoadTexture2D("Graphics/Backgrounds/clouds_parallax")); dbox = new DialogueBox("Scripts/forestScript.txt"); dbox.LoadDBox(); dbox.IsActive = true; dbox2 = new DialogueBox("Scripts/forestScript2.txt"); dbox2.LoadDBox(); controls = new List <string>(); controls.Add("Use <A> and <D> to move left and right and <W> or <Space> to jump."); controls.Add("This is your canteen.\nPress <Q> to take a drink and heal for 1 health."); controls.Add("This is your current health."); controls.Add("You can refill your canteen by interacting, <E>, with ponds like this."); controls.Add("Use the mouse to move your flashlight around."); controls.Add("You can pause the game by pressing <Escape>"); controlsPos = new List <Vector2>(); controlsPos.Add(level.Player.Position - new Vector2(210, 200)); controlsPos.Add(new Vector2(1280 - 500, 960 - 75)); controlsPos.Add(new Vector2(1280 - 245, 115)); controlsPos.Add(new Vector2(2688 - 200, 416 + 70)); controlsPos.Add(level.Player.Position - new Vector2(130, 150)); controlsPos.Add(new Vector2(TextTools.CenterText(ScreenManager.ExtraSmallFont, controls[5]).X, 50)); friend1 = new Animation(ImageTools.LoadTexture2D("Characters/Friends/pat"), new int[] { 0, 0, 0, 0, 0, 1 }, 32, true); friend1.FrameTime = .75f; f1Pos = level.Player.Position + new Vector2(64, 0); friend2 = new Animation(ImageTools.LoadTexture2D("Characters/Friends/naomi"), new int[] { 0, 0, 1, 0, 0, 0 }, 32, true); friend2.FrameTime = .75f; f2Pos = f1Pos + new Vector2(50, 0); friendBoundingBox = new Rectangle((int)f1Pos.X, (int)f1Pos.Y, 64 + 18, 64); ScreenManager.LightingEngine.SetLightPower(3); base.LoadContent(); }
/// <summary> /// draw graphical content for each screen in screenlist /// </summary> /// <param name="gameTime"></param> protected override void Draw(GameTime gameTime) { if (LightingEnabled) { GraphicsDevice.SetRenderTarget(LightingEngine.Colormap); GraphicsDevice.Clear(Color.Black); } var startIndex = ScreenList.Count - 1; while (ScreenList[startIndex].IsPopup) { startIndex--; } //to set a custom background color GraphicsDevice.Clear(ScreenList[startIndex].BackgroundColor); for (var i = startIndex; i < ScreenList.Count; i++) { ScreenList[i].Draw(gameTime); } if (LightingEnabled) { GraphicsDevice.SetRenderTarget(LightingEngine.Normalmap); SpriteBatch.Begin(); SpriteBatch.Draw(normal, new Rectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), Color.White); SpriteBatch.End(); LightingEngine.Draw(null, SpriteBatch, new Rectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); } //in order to draw certain HUD content that shouldnt be darkened by the lighting for (var i = startIndex; i < ScreenList.Count; i++) { ScreenList[i].DrawOverLighting(gameTime); } if (fpsCount) { float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; fpsCounter.Update(deltaTime); var fps = string.Format("FPS: {0}", fpsCounter.AverageFramesPerSecond); SpriteBatch.Begin(); SpriteBatch.DrawString(ExtraSmallFont, fps, new Vector2(TextTools.CenterText(ExtraSmallFont, fps).X, 0), Color.White); SpriteBatch.End(); } base.Draw(gameTime); }
/// <summary> /// update timer and draw text /// </summary> /// <param name="gameTime"></param> public override void DrawOverLighting(GameTime gameTime) { time += (float)gameTime.ElapsedGameTime.TotalSeconds; if (time > 3) { ScreenManager.ChangeScreens(this, new MainMenuScreen()); } ScreenManager.SpriteBatch.Begin(); ScreenManager.SpriteBatch.DrawString(ScreenManager.SmallFont, text, TextTools.CenterText(ScreenManager.SmallFont, text), Color.White); ScreenManager.SpriteBatch.End(); base.DrawOverLighting(gameTime); }
/// <summary> /// draw buttons over lighting /// </summary> /// <param name="gameTime"></param> public override void DrawOverLighting(GameTime gameTime) { ScreenManager.SpriteBatch.Begin(); Vector2 pos = new Vector2(TextTools.CenterText(ScreenManager.ExtraSmallFont, "Below auto-saves the game whenever a new scene is loaded").X, 50); ScreenManager.SpriteBatch.DrawString(ScreenManager.ExtraSmallFont, "Below auto-saves the game whenever a new scene is loaded", pos, Color.White); ScreenManager.SpriteBatch.End(); resumeButton.Draw(); settingsButton.Draw(); exitButton.Draw(); exitToDesktopButton.Draw(); base.Draw(gameTime); }
/// <summary> /// draw text over lighting /// </summary> /// <param name="gameTime"></param> public override void DrawOverLighting(GameTime gameTime) { ScreenManager.SpriteBatch.Begin(); ScreenManager.SpriteBatch.DrawString(ScreenManager.LargeFont, "You died.", TextTools.CenterText(ScreenManager.LargeFont, "You died."), Color.DarkRed); ScreenManager.SpriteBatch.End(); base.Draw(gameTime); }