Time for action – spawning enemies
Add the
SpawnEnemy()
method to theEnemyManager
class:Public Sub SpawnEnemy(path As Integer) Dim thisEnemy As Enemy = new Enemy( _texture, pathWaypoints(path)(0), _initialFrame, _frameCount) For x As Integer = 0 to pathWaypoints(path).Count - 1 thisEnemy.AddWaypoint(pathWaypoints(path)(x)) Next Enemies.Add(thisEnemy) End Sub
Add the
SpawnWave()
method to theEnemyManager
class:Public Sub SpawnWave(waveType As Integer) waveSpawns(waveType) += rand.Next(MinShipsPerWave, MaxShipsPerWave + 1) End Sub
Add the
updateWaveSpawns()
method to theEnemyManager
class:Private Sub updateWaveSpawns(gameTime As GameTime) shipSpawnTimer += CSng(gameTime.ElapsedGameTime.TotalSeconds) If shipSpawnTimer > shipSpawnWaitTime Then For x As Integer = waveSpawns.Count - 1 To 0 Step -1 if waveSpawns(x) > 0 Then waveSpawns(x) -= 1 SpawnEnemy(x) ...