mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-31 00:05:02 -07:00
Added reset platforms.
This commit is contained in:
@@ -108,6 +108,9 @@ namespace LunaLightXMG
|
||||
// Temporary quit game - eventually handle in a pause menu class
|
||||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
|
||||
Exit();
|
||||
// Check for game reset
|
||||
if (Keyboard.GetState().IsKeyDown(Keys.R))
|
||||
ResetGame();
|
||||
|
||||
// Test player input and movement with abstracted player class
|
||||
playerInput.Update();
|
||||
@@ -236,5 +239,17 @@ namespace LunaLightXMG
|
||||
{
|
||||
return (float)(1 + 2 * random.NextDouble());
|
||||
}
|
||||
private void ResetGame()
|
||||
{
|
||||
// Reset player position
|
||||
player.Reset(new Vector2(163, 0));
|
||||
|
||||
// Clear and respawn enemies
|
||||
enemies.Clear();
|
||||
enemies = SpawnEnemies(10);
|
||||
|
||||
// Regenerate platforms
|
||||
platforms = PlatformGenerator.CreatePlatforms(6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user