title: XNA Simple way to spawn enemys
body: <p>Im trying to spawn enemies from a list. I've tryed multiple ways in doing so. However I can't 
  get it to work. Is there a simple way to spawn enemes every 3 seconds?
  EDIT</p>
  
  <p>I tried spawning it like this:  problem: only spawns once</p>
  
  <pre><code>    protected void AdjustSpawnTimes(GameTime gameTime)
      {
          // If the spawn maximum time is &gt; 500 milliseconds,
          // decrease the spawn time if it's time to do so
          // based on spawn-timer variables
          if (enemySpawnMaxMilliseconds &gt; 500)
          {
              timeSinceLastSpawnTimeChange += gameTime.ElapsedGameTime.Milliseconds;
              if (timeSinceLastSpawnTimeChange &gt; nextSpawnTimeChange)
              {
                  timeSinceLastSpawnTimeChange -= nextSpawnTimeChange;
                  if (enemySpawnMaxMilliseconds &gt; 1000)
                  {
                      enemySpawnMaxMilliseconds -= 100;
                      enemySpawnMinMilliseconds -= 100;
                  }
                  else
                  {
                      enemySpawnMaxMilliseconds -= 10;
                      enemySpawnMinMilliseconds -= 10;
                  }
              }
          }
      }
  </code></pre>
  
  <p>and like this: problem: again spawns once</p>
  
  <pre><code>private void SpawnEnemy()
      {
          Vector2 speed = Vector2.Zero;
          Vector2 position = Vector2.Zero;
  
          // Default frame size
          Point frameSize = new Point(75, 75);
  
          int screenWidth = GraphicsDevice.PresentationParameters.BackBufferWidth;
          int screenHeight = GraphicsDevice.PresentationParameters.BackBufferHeight;
  
          // Randomization:
          // - Randomly choose which side of the screen to place the enemy
          // - Randomly create a position along that side of the screen
          // - Randomly choose a speed for the enemy
          switch (rand.Next(4))
          {
              case 0: // Left to right
                  position = new Vector2(-frameSize.X,
                                         (rand.Next(0, screenHeight - frameSize.Y)));
                  speed = new Vector2(rand.Next(needleMinV, needleMaxV),
                                      0);
                  break;
  
              case 1: // Right to left
                  position = new Vector2(screenWidth,
                                         (rand.Next(0, screenHeight - frameSize.Y)));
                  speed = -new Vector2(rand.Next(needleMinV, needleMaxV),
                                      0);
                  break;
  
              case 2: // Bottom to top
                  position = new Vector2(rand.Next(0, screenWidth - frameSize.X),
                                         screenHeight);
                  speed = -new Vector2(0,
                                      (rand.Next(needleMinV, needleMaxV)));
                  break;
  
              case 3: // Top to bottom
                  position = new Vector2(rand.Next(0, screenWidth - frameSize.X),
                                         -frameSize.Y);
                  speed = new Vector2(0,
                                     rand.Next(needleMinV, needleMaxV));
                  break;
          }
  </code></pre>
  
  <p>and this one spawns but does not move ive played around with the updat and draw method but nothing seems to work</p>
  
  <pre><code>List&lt;Enemy&gt; needleList = new List&lt;Enemy&gt;();
      Texture2D needle;
      float spawnTime = 10;
      const float TIMER = 10;
      bool spawnN = true;
  </code></pre>
  
  <p>in update:</p>
  
  <pre><code>    timer = (float)gameTime.TotalGameTime.TotalSeconds;
  
          spawnTime -= (float)gameTime.ElapsedGameTime.TotalSeconds;
          if (timer &lt; 0)
          {
              foreach (Enemy needele in needleList)
              {
                  spawnN = !spawnN;
                  needele.Update(gameTime);
                  spawnTime = TIMER;
              }
  </code></pre>
  
  <p>in draw:</p>
  
  <pre><code>    if (spawnN)
          {
              foreach (Enemy needele in needleList)
              {
                  needele.Draw(gameTime, spriteBatch);
              }
          }
  </code></pre>