Add ability to restart the level. Fixes #9.
GitOrigin-RevId: e7a0cdcdded50e2f02067a166a33e18504aac344
This commit is contained in:
parent
a32ef2a0eb
commit
e2ea2e1d3f
@ -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);
|
||||
|
||||
|
@ -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<SpriteFont>("font");
|
||||
|
||||
player = new Player(Content.Load<Texture2D>("Ninja_Female"));
|
||||
world = new World(Content.Load<Texture2D>("grassland"), Levels.ONE_ONE);
|
||||
linesOfSight = new LinesOfSight(GraphicsDevice);
|
||||
grasslandBg1 = Content.Load<Texture2D>("grassland_bg1");
|
||||
grasslandBg2 = Content.Load<Texture2D>("grassland_bg2");
|
||||
LoadLevel();
|
||||
}
|
||||
|
||||
private void LoadLevel() {
|
||||
camera = new Camera();
|
||||
player = new Player(Content.Load<Texture2D>("Ninja_Female"));
|
||||
world = new World(Content.Load<Texture2D>("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;
|
||||
|
Loading…
Reference in New Issue
Block a user