protected override void Update(GameTime gameTime) { Input.Update(); cursor.Update(); camera.Update(); if (Input.GP_IsPressed(PlayerIndex.One, Buttons.Back)) currentState = GameState.Exit; switch (currentState) { case GameState.MainMenu: menu.Update(); break; case GameState.Initialize: Game1.baine = new Baine(Game1.level.startPos, "BaineStanding", Level.BaineLayer); currentState = GameState.InGame; break; case GameState.InGame: baine.Update(gameTime); level.Update(gameTime); if (Input.Key_NewDown(Keys.Escape)) currentState = GameState.MainMenu; break; case GameState.Editor: levelEditor.Update(); break; case GameState.Exit: SaveFileManager saver = new SaveFileManager(); this.Exit(); break; case GameState.GameOver: if (Input.Key_AnyNewKey()) currentState = GameState.MainMenu; break; } base.Update(gameTime); }
protected override void LoadContent() { gameIsStarted = false; spriteBatch = new SpriteBatch(GraphicsDevice); Library.LoadContent(Content); random = new Random(); cursor = new Cursor(); level = new Level(); levelEditor = new LevelEditor(); saver = new SaveFileManager(); saver.LoadLevel("level1"); camera = new Camera(new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height)); HUDCamera = new Camera(new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height)); camera.CenterOn(level.startPos); HUDCamera.CenterOn(level.startPos); camera.Update(); HUDCamera.Update(); menu = new Menu(); currentState = GameState.MainMenu; parallaxClouds = new ParallaxBackground(Vector2.Zero, Library.textures["Clouds"], 0.5f); parallaxMoon = new ParallaxBackground(new Vector2(700, 20), Library.textures["Moon"], 0.4f); //graphics.PreferredBackBufferHeight = (int)(graphics.PreferredBackBufferWidth / GraphicsDevice.DisplayMode.AspectRatio); if(GraphicsDevice.DisplayMode.AspectRatio == (8/6)) graphics.IsFullScreen = true; graphics.ApplyChanges(); song = Library.sounds["BaineSong"]; songLoop = song.CreateInstance(); songLoop.IsLooped = true; songLoop.Play(); }