public ParalaxBackgroundManager(Player player, SpriteSheetLoader loader, GraphicsDevice graphicsDevice, GameWindow window) { this.player = player; dayBackgrounds = new List <ScrollingBackground>(); nightBackgrounds = new List <ScrollingBackground>(); Texture2D cloudsTex = loader.LoadTexture("background"); Texture2D nightHillTex = loader.LoadTexture("Backgrounds\\NightHill"); Texture2D nightHillBackTex = loader.LoadTexture("Backgrounds\\NightHillBack"); Texture2D nightSkyTex = loader.LoadTexture("Backgrounds\\NightSky"); Texture2D moonTex = loader.LoadTexture("Backgrounds\\moon"); Texture2D dayHillTex = loader.LoadTexture("Backgrounds\\DayHill"); Texture2D dayHillBackTex = loader.LoadTexture("Backgrounds\\DayHillBack"); Texture2D daySkyTex = loader.LoadTexture("Backgrounds\\DaySky"); dayBackgrounds.Add(new ScrollingBackground(dayHillBackTex, new Rectangle(0, window.ClientBounds.Height - dayHillBackTex.Height, window.ClientBounds.Width, (int)(dayHillBackTex.Height)), 0.25f, -dayHillBackTex.Height / 2 + 3)); dayBackgrounds.Add(new ScrollingBackground(dayHillTex, new Rectangle(-150, window.ClientBounds.Height - dayHillTex.Height + 45, window.ClientBounds.Width, (int)(dayHillTex.Height)), 0.3f, -dayHillTex.Height / 2 - 42)); dayBackgrounds.Add(new ScrollingBackground(dayHillTex, new Rectangle(-100, window.ClientBounds.Height - dayHillTex.Height + 30, window.ClientBounds.Width, (int)(dayHillTex.Height)), 0.35f, -dayHillTex.Height / 2 - 27)); dayBackgrounds.Add(new ScrollingBackground(daySkyTex, new Rectangle(0, 0, window.ClientBounds.Width, daySkyTex.Height), 0.1f, 0)); dayBackgrounds.Add(new ScrollingBackground(cloudsTex, new Rectangle(0, 0, window.ClientBounds.Width, cloudsTex.Height), 0.5f, 0)); nightBackgrounds.Add(new ScrollingBackground(nightHillBackTex, new Rectangle(0, window.ClientBounds.Height - nightHillBackTex.Height, window.ClientBounds.Width, (int)(nightHillBackTex.Height)), 0.25f, -nightHillBackTex.Height / 2 + 3)); nightBackgrounds.Add(new ScrollingBackground(nightHillTex, new Rectangle(-150, window.ClientBounds.Height - nightHillTex.Height + 45, window.ClientBounds.Width, nightHillTex.Height), 0.3f, -nightHillTex.Height / 2 - 42)); nightBackgrounds.Add(new ScrollingBackground(nightHillTex, new Rectangle(-100, window.ClientBounds.Height - nightHillTex.Height + 30, window.ClientBounds.Width, nightHillTex.Height), 0.35f, -nightHillTex.Height / 2 - 27)); nightBackgrounds.Add(new ScrollingBackground(nightSkyTex, new Rectangle(0, 0, window.ClientBounds.Width, nightSkyTex.Height), 0.1f, 0)); nightBackgrounds.Add(new ScrollingBackground(moonTex, new Rectangle((int)(window.ClientBounds.Width * 0.1), (int)(window.ClientBounds.Height * 0.01), moonTex.Width / 3, moonTex.Height), 0.1f, 0)); }
private void StartGame() { HUD hud = new HUD(Window, 100, 100, spritesheetLoader.LoadTexture("score-numbers"), spritesheetLoader.LoadSpriteSheet("player", Vector2.Zero, new Vector2(16, 16)).GetAt(0, 0)); menu = new MenuState(font, Window, hud); menu.Actions.Add(new MenuOption("1. Start Game", () => gameState = inGameState)); menu.Actions.Add(new MenuOption("2. Open Editor", () => gameState = editor)); menu.Actions.Add(new MenuOption("3. Exit", () => Exit())); inGameState = new InGameState(spritesheetLoader, GraphicsDevice, Window, hud, font); editor = new Editor(spritesheetLoader, Window); editor.LoadLevel("Content\\Level1.lvl"); gameState = menu; }