mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-30 21:55:03 -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace LunaLightXMG
|
||||
// Left side wall (static)
|
||||
List<Platform> leftSidePlatforms = new List<Platform>
|
||||
{
|
||||
new Platform(new Vector2(0, -28), 16, 16),
|
||||
new Platform(new Vector2(0, -12), 16, 16),
|
||||
new Platform(new Vector2(0, 4), 16, 16),
|
||||
new Platform(new Vector2(0, 20), 16, 16),
|
||||
@@ -72,6 +73,7 @@ namespace LunaLightXMG
|
||||
// Right side wall (static)
|
||||
List<Platform> rightSidePlatforms = new List<Platform>
|
||||
{
|
||||
new Platform(new Vector2(304, -28), 16, 16),
|
||||
new Platform(new Vector2(304, -12), 16, 16),
|
||||
new Platform(new Vector2(304, 4), 16, 16),
|
||||
new Platform(new Vector2(304, 20), 16, 16),
|
||||
@@ -100,6 +102,8 @@ namespace LunaLightXMG
|
||||
{
|
||||
List<Platform> platforms = new List<Platform>();
|
||||
platforms.Add(new Platform(new Vector2(16, 132), 16, 16));
|
||||
platforms.Add(new Platform(new Vector2(144, 132), 16, 16));
|
||||
platforms.Add(new Platform(new Vector2(160, 132), 16, 16));
|
||||
platforms.Add(new Platform(new Vector2(288, 132), 16, 16));
|
||||
|
||||
for (int i = 0; i < numberOfPlatforms; i++)
|
||||
|
||||
@@ -74,6 +74,12 @@ namespace LunaLightXMG
|
||||
}
|
||||
|
||||
// Method Implementation -------------------------------------------------------------------------------
|
||||
public void Reset(Vector2 initialPosition)
|
||||
{
|
||||
position = initialPosition;
|
||||
// Reset other player-specific states later
|
||||
}
|
||||
|
||||
private void Movement(PlayerInput input)
|
||||
{
|
||||
if (input.KeyJump && grounded)
|
||||
|
||||
Reference in New Issue
Block a user