mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-30 23:35:02 -07:00
Moved number of enemies/platforms init into Game1 constructor.
This commit is contained in:
@@ -14,6 +14,7 @@ namespace LunaLightXMG
|
|||||||
private Player player;
|
private Player player;
|
||||||
private PlayerInput playerInput;
|
private PlayerInput playerInput;
|
||||||
private List<Enemy> enemies;
|
private List<Enemy> enemies;
|
||||||
|
private int numOfEnemies;
|
||||||
private GraphicsDeviceManager graphics;
|
private GraphicsDeviceManager graphics;
|
||||||
private SpriteBatch spriteBatch;
|
private SpriteBatch spriteBatch;
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ namespace LunaLightXMG
|
|||||||
|
|
||||||
// Test platforms
|
// Test platforms
|
||||||
private Platform[] platforms;
|
private Platform[] platforms;
|
||||||
|
private int numOfPlatforms;
|
||||||
|
|
||||||
// Music
|
// Music
|
||||||
private SoundEffect sinkBeats;
|
private SoundEffect sinkBeats;
|
||||||
@@ -61,6 +63,10 @@ namespace LunaLightXMG
|
|||||||
enemies = new List<Enemy>();
|
enemies = new List<Enemy>();
|
||||||
|
|
||||||
random = new Random(42);
|
random = new Random(42);
|
||||||
|
|
||||||
|
// Init number of platforms / enemies
|
||||||
|
numOfPlatforms = 3;
|
||||||
|
numOfEnemies = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
@@ -78,7 +84,7 @@ namespace LunaLightXMG
|
|||||||
PlayBackgroundMusic(sinkBeats);
|
PlayBackgroundMusic(sinkBeats);
|
||||||
|
|
||||||
// Generate random platforms - test this idea out...
|
// Generate random platforms - test this idea out...
|
||||||
platforms = PlatformGenerator.CreatePlatforms(6);
|
platforms = PlatformGenerator.CreatePlatforms(numOfPlatforms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -95,7 +101,7 @@ namespace LunaLightXMG
|
|||||||
player.LoadContent(Content); // player sprite is now handled in player.cs
|
player.LoadContent(Content); // player sprite is now handled in player.cs
|
||||||
|
|
||||||
// Spawn 10 enemies at the start of the level
|
// Spawn 10 enemies at the start of the level
|
||||||
enemies = SpawnEnemies(10);
|
enemies = SpawnEnemies(numOfEnemies);
|
||||||
|
|
||||||
// Test Render Target
|
// Test Render Target
|
||||||
renderTarget = new RenderTarget2D(GraphicsDevice, retroWidth, retroHeight);
|
renderTarget = new RenderTarget2D(GraphicsDevice, retroWidth, retroHeight);
|
||||||
@@ -180,7 +186,7 @@ namespace LunaLightXMG
|
|||||||
return enemies;
|
return enemies;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlayBackgroundMusic(SoundEffect backgroundMusic)
|
private void PlayBackgroundMusic(SoundEffect backgroundMusic)
|
||||||
{
|
{
|
||||||
if (backgroundMusicInstance == null || backgroundMusicInstance.State != SoundState.Playing)
|
if (backgroundMusicInstance == null || backgroundMusicInstance.State != SoundState.Playing)
|
||||||
{
|
{
|
||||||
@@ -249,10 +255,10 @@ namespace LunaLightXMG
|
|||||||
|
|
||||||
// Clear and respawn enemies
|
// Clear and respawn enemies
|
||||||
enemies.Clear();
|
enemies.Clear();
|
||||||
enemies = SpawnEnemies(10);
|
enemies = SpawnEnemies(numOfEnemies);
|
||||||
|
|
||||||
// Regenerate platforms
|
// Regenerate platforms
|
||||||
platforms = PlatformGenerator.CreatePlatforms(6);
|
platforms = PlatformGenerator.CreatePlatforms(numOfPlatforms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user