public MenuScreen(LD35Game game) { this.game = game; Font font = game.Fonts.Load("Data/Fonts/upheavtt.ttf"); title = new Text("Space Junk", font, 20); title.Position = Position(title, -(game.RenderTarget.GetView().Size.Y / 2f) - 64f); title.Color = game.Palette; help = new Text("Push enter to continue.", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); help.Position = Position(help, -(game.RenderTarget.GetView().Size.Y / 2f) - 64f); help.Color = game.Palette; paragraph1 = new Text("Use keys 1 - 4 to buy modules of their respective sizes.", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); paragraph1.Position = Position(paragraph1, game.RenderTarget.GetView().Size.Y / 2f); paragraph1.Color = game.Palette; paragraph2 = new Text("Place modules with a left click, adjacent to existing modules.", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); paragraph2.Position = Position(paragraph2, game.RenderTarget.GetView().Size.Y / 2f); paragraph2.Color = game.Palette; paragraph3 = new Text("Pick up existing modules with a left click.", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); paragraph3.Position = Position(paragraph3, game.RenderTarget.GetView().Size.Y / 2f); paragraph3.Color = game.Palette; paragraph4 = new Text("Earn enough cash to pay off your orbit-space rent (larger modules = more income).", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); paragraph4.Position = Position(paragraph4, game.RenderTarget.GetView().Size.Y / 2f); paragraph4.Color = game.Palette; paragraph5 = new Text("Press shift to pause the game.", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); paragraph5.Position = Position(paragraph5, game.RenderTarget.GetView().Size.Y / 2f); paragraph5.Color = game.Palette; paragraph6 = new Text("Watch out for space junk!", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); paragraph6.Position = Position(paragraph6, game.RenderTarget.GetView().Size.Y / 2f); paragraph6.Color = game.Palette; play = new Sound(game.SoundBuffers.Load("Data/Sounds/play.wav")); loop = new Music("Data/Sounds/menu_loop.wav"); loop.Loop = true; loop.Play(); }
public LoseScreen(LD35Game game, float time) { this.game = game; play = new Sound(game.SoundBuffers.Load("Data/Sounds/play.wav")); game.RenderTarget.SetView(game.RenderTarget.DefaultView); Font font = game.Fonts.Load("Data/Fonts/upheavtt.ttf"); fail = new Text("Operation Failure", font, 20); fail.Position = Position(fail, -(game.RenderTarget.GetView().Size.Y / 2f) - 64f); fail.Color = game.Palette; text = new Text("Your facility ran for " + Math.Floor(time) + " seconds.", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); text.Position = Position(text, -(game.RenderTarget.GetView().Size.Y / 2f) - 64f); text.Color = game.Palette; nextText = new Text("Push enter to continue, or space to restart.", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); nextText.Position = Position(nextText, -(game.RenderTarget.GetView().Size.Y / 2f) - 64f); nextText.Color = game.Palette; }
private static void Main(string[] args) { LD35Game game = new LD35Game(); game.Run(); }
public GameScreen(LD35Game game) { this.game = game; registry = new ModuleRegistry(game.Textures); fortress = new Fortress(registry); planet = new Sprite(game.Textures.Load("Data/Textures/planet.png")); buy = new Sound(game.SoundBuffers.Load("Data/Sounds/buy.wav")); explosion = new Sound(game.SoundBuffers.Load("Data/Sounds/explosion.wav")); payment = new Sound(game.SoundBuffers.Load("Data/Sounds/payment.wav")); pickup = new Sound(game.SoundBuffers.Load("Data/Sounds/pickup.wav")); place = new Sound(game.SoundBuffers.Load("Data/Sounds/place.wav")); play = new Sound(game.SoundBuffers.Load("Data/Sounds/play.wav")); pause = new Sound(game.SoundBuffers.Load("Data/Sounds/pause.wav")); nope = new Sound(game.SoundBuffers.Load("Data/Sounds/nope.wav")); loop = new Music("Data/Sounds/loop.wav"); loop.Loop = true; loop.Play(); top = game.Textures.Load("Data/Textures/border_top.png"); right = game.Textures.Load("Data/Textures/border_right.png"); bottom = game.Textures.Load("Data/Textures/border_bottom.png"); left = game.Textures.Load("Data/Textures/border_left.png"); topRight = game.Textures.Load("Data/Textures/border_top_right.png"); topLeft = game.Textures.Load("Data/Textures/border_top_left.png"); bottomRight = game.Textures.Load("Data/Textures/border_bottom_right.png"); bottomLeft = game.Textures.Load("Data/Textures/border_bottom_left.png"); View view = game.RenderTarget.GetView(); view.Center = fortress.Position + new Vector2f(fortress.Width + 0.5f, fortress.Height + 0.5f) * 8f; game.RenderTarget.SetView(view); text = new Text("Cash:", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); text.Position = game.RenderTarget.GetView().TopLeft() + new Vector2f(-24f + game.RenderTarget.GetView().Size.X / 2f - text.GetLocalBounds().Width / 2f, 4f); text.Color = game.Palette; text2 = new Text("Next Payment:", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12); text2.Position = game.RenderTarget.GetView().TopLeft() + new Vector2f(-32f + game.RenderTarget.GetView().Size.X / 2f - text2.GetLocalBounds().Width / 2f, 20f); text2.Color = game.Palette; singlePosition = new Vector2f(game.RenderTarget.GetView().Center.X - 8f, game.RenderTarget.GetView().Bottom()); scaffoldPosition = new Vector2f(game.RenderTarget.GetView().Center.X - 8f, game.RenderTarget.GetView().Bottom()); triplePosition = new Vector2f(game.RenderTarget.GetView().Center.X - 8f, game.RenderTarget.GetView().Bottom()); quadruplePosition = new Vector2f(game.RenderTarget.GetView().Center.X - 8f, game.RenderTarget.GetView().Bottom()); singleText = new Text("1: $25b", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12) { Color = game.Palette }; scaffoldText = new Text("2: $50b", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12) { Color = game.Palette }; tripleText = new Text("3: $100b", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12) { Color = game.Palette }; quadrupleText = new Text("4: $200b", game.Fonts.Load("Data/Fonts/TourDeForce.ttf"), 12) { Color = game.Palette }; singleText.Position = singlePosition - new Vector2f(16f, 16f); scaffoldText.Position = singlePosition - new Vector2f(16f, 16f); tripleText.Position = singlePosition - new Vector2f(16f, 16f); quadrupleText.Position = singlePosition - new Vector2f(16f, 16f); pauseSprite = new Sprite(game.Textures.Load("Data/Textures/pause.png")); pauseSprite.Position = game.RenderTarget.GetView().TopLeft() + new Vector2f(game.RenderTarget.GetView().Size.X - 48f, 16f); pauseSprite.Color = game.Palette; flash = new Sprite(game.Textures.Load("Data/Textures/palette.png"), new IntRect(3, 0, 1, 1)); flash.Position = game.RenderTarget.GetView().TopLeft() - new Vector2f(8f, 0f); flash.Scale = game.RenderTarget.GetView().Size + new Vector2f(16f, 0f); flash.Color = game.Palette; for (int i = 0; i < 500; i++) { Sprite star = new Sprite(game.Textures.Load("Data/Textures/palette.png"), new IntRect(random.Next(1, 4), 0, 1, 1)); star.Position = game.RenderTarget.GetView().TopLeft() + new Vector2f((float)(random.NextDouble() * game.RenderTarget.Size.X), (float)(random.NextDouble() * game.RenderTarget.Size.X)); star.Color = game.Palette; stars.Add(star); } fortress.Palette = game.Palette; planet.Position = new Vector2f(game.RenderTarget.Size.X / 2f, 0f); planet.Color = game.Palette; }