title: How can I delay each bullet? (Java -Slick2d - Game)
body: <p>(The event listener is in another class) When Game.render = true, i get a constant stream of bullets that look more like a laser-beam, i want there to be gaps. What I mean is that I would like the bullets to be generated as if they were being fired from a machine gun. I know i should add a time or something, but I'm not sure how to do that, to get the effect I want. Any help would be greatly appreciated because I've been trying to get this to work for about an hour now.</p>
  
  <pre><code>import java.util.ArrayList;
  import org.newdawn.slick.GameContainer;
  import org.newdawn.slick.Graphics;
  import org.newdawn.slick.SlickException;
  
  public class Bullet {
  
  // ArrayList
  @SuppressWarnings("unchecked")
  static ArrayList&lt;Bullet&gt; arrL = new ArrayList();
  
  public Bullet(int x , int y) throws SlickException{
  
  
  
  }
  
  public static void update(GameContainer gc, int u) throws SlickException{
  
  // when the left mouse button is clicked Game.fire = true, the key listener is in   another class
      if(Game.fire){
  
          Bullet b = new Bullet(5,5);
          arrL.add(b);
          reloaded = false;
  
      }   if(!reloaded){
  
  
  
      }           
  }
  
  public static void renderBullets(GameContainer gc, Graphics g, int x, int y) {
  
           // draws a new bullet for every 'bullet object' in  the ArrayList called arrL
          for(Bullet b : arrL){
  
              g.drawRect(x,y,10,10);
              x++;
  
          }
      }
  }
  </code></pre>