From d7f84ce34a6a0b06ef8e8c70a197939c641be246 Mon Sep 17 00:00:00 2001 From: "J. M. Ellis" Date: Sun, 2 Jun 2024 17:59:24 -0700 Subject: [PATCH] Quik update --- Game1.cs | 24 +++++++++++++++--------- Platform.cs | 8 +++++++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Game1.cs b/Game1.cs index f73e189..5bb15ff 100644 --- a/Game1.cs +++ b/Game1.cs @@ -77,7 +77,7 @@ namespace LunaLightXMG PlayBackgroundMusic(sinkBeats); // Generate random platforms - test this idea out... - platforms = PlatformGenerator.CreatePlatforms(14); + platforms = PlatformGenerator.CreatePlatforms(6); } @@ -93,13 +93,7 @@ namespace LunaLightXMG player.LoadContent(Content); // player sprite is now handled in player.cs // Spawn 10 enemies at the start of the level - for (int i = 0; i < 10; i++) - { - Vector2 spawnPosition = new Vector2(16 + i*3,-16); - Enemy enemy = new Enemy(spawnPosition, GetRandomValueBetween1And3()); - enemy.LoadContent(Content); - enemies.Add(enemy); - } + enemies = SpawnEnemies(10); // Test Render Target renderTarget = new RenderTarget2D(GraphicsDevice, retroWidth, retroHeight); @@ -168,7 +162,19 @@ namespace LunaLightXMG } // Method Implementation ------------------------------------------------------------------------------- - private void PlayBackgroundMusic(SoundEffect backgroundMusic) + private List SpawnEnemies(int numberOfEnemies) { + List enemies = new List(); + for (int i = 0; i < numberOfEnemies; i++) + { + Vector2 spawnPosition = new Vector2(16 + i * 3, -16); + Enemy enemy = new Enemy(spawnPosition, GetRandomValueBetween1And3()); + enemy.LoadContent(Content); + enemies.Add(enemy); + } + return enemies; + } + + private void PlayBackgroundMusic(SoundEffect backgroundMusic) { if (backgroundMusicInstance == null || backgroundMusicInstance.State != SoundState.Playing) { diff --git a/Platform.cs b/Platform.cs index 59d9a5e..6c6972c 100644 --- a/Platform.cs +++ b/Platform.cs @@ -126,8 +126,14 @@ namespace LunaLightXMG } } platforms.Add(new Platform(new Vector2(x, y + 4), 16, 16)); + if (x + 16 < 288) + { + for (int j = 1; j < 3; j++) + { + platforms.Add(new Platform(new Vector2(x + (j*16), y + 4), 16, 16)); + } + } } - return platforms; } }