diff --git a/Shared/Input.cs b/Shared/Input.cs index c15cfd3..ec04b89 100644 --- a/Shared/Input.cs +++ b/Shared/Input.cs @@ -10,6 +10,7 @@ namespace SemiColinGames { public bool Pause; public bool Debug; public bool Exit; + public bool Restart; public bool FullScreen; public Input(GamePadState gamePad, KeyboardState keyboard) { @@ -24,10 +25,15 @@ namespace SemiColinGames { (gamePad.IsButtonDown(Buttons.LeftShoulder) && gamePad.IsButtonDown(Buttons.RightShoulder) && gamePad.IsButtonDown(Buttons.Start)); - FullScreen = keyboard.IsKeyDown(Keys.F12) || keyboard.IsKeyDown(Keys.OemPlus) || + Restart = keyboard.IsKeyDown(Keys.F5) || (gamePad.IsButtonDown(Buttons.LeftShoulder) && gamePad.IsButtonDown(Buttons.RightShoulder) && gamePad.IsButtonDown(Buttons.Back)); + FullScreen = keyboard.IsKeyDown(Keys.F12) || keyboard.IsKeyDown(Keys.OemPlus) || + (gamePad.IsButtonDown(Buttons.LeftShoulder) && + gamePad.IsButtonDown(Buttons.RightShoulder) && + gamePad.IsButtonDown(Buttons.Y)); + Debug = gamePad.IsButtonDown(Buttons.LeftShoulder) || keyboard.IsKeyDown(Keys.OemMinus); Pause = gamePad.IsButtonDown(Buttons.Start) || keyboard.IsKeyDown(Keys.Pause); diff --git a/Shared/SneakGame.cs b/Shared/SneakGame.cs index 1414097..12d2238 100644 --- a/Shared/SneakGame.cs +++ b/Shared/SneakGame.cs @@ -37,7 +37,7 @@ namespace SemiColinGames { Player player; World world; LinesOfSight linesOfSight; - readonly Camera camera = new Camera(); + Camera camera = new Camera(); public SneakGame() { graphics = new GraphicsDeviceManager(this) { @@ -83,12 +83,16 @@ namespace SemiColinGames { base.LoadContent(); spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load("font"); - - player = new Player(Content.Load("Ninja_Female")); - world = new World(Content.Load("grassland"), Levels.ONE_ONE); linesOfSight = new LinesOfSight(GraphicsDevice); grasslandBg1 = Content.Load("grassland_bg1"); grasslandBg2 = Content.Load("grassland_bg2"); + LoadLevel(); + } + + private void LoadLevel() { + camera = new Camera(); + player = new Player(Content.Load("Ninja_Female")); + world = new World(Content.Load("grassland"), Levels.ONE_ONE); } // Called once per game. Unloads all game content. @@ -116,6 +120,10 @@ namespace SemiColinGames { display.SetFullScreen(fullScreen); } + if (input[0].Restart && !input[1].Restart) { + LoadLevel(); + } + Debug.Clear(paused); if (input[0].Debug && !input[1].Debug) { Debug.Enabled = !Debug.Enabled;