title: Array to display images, however need to create another method to choose how many times to display
body: <p>I explained that horridly in the title, and I apologize, am very new to java and don't quite understand some of it yet.</p>
  
  <p>Anyway, my cat animation runs to the middle of the screen, scratches twice, then continues to run to the end, is there anyway to write a method that will take <code>int num</code> as the parameter making neko scratch <code>x</code> amount of times depending on the input?</p>
  
  <p>Any help would be much appreciated</p>
  
  <p>Here is my current code</p>
  
  <pre><code>// Run the animation. 
  public void nekoRun() {
      moveIn();
      scratch();
      //scratch2(5);
      moveOut();
  }
  
  // Move Neko to the centre of the panel
  private void moveIn() {
      for (int i = 0; i &lt; getWidth()/2; i+=10) {
          xPos = i;
          // swap images
          if (currentImage == nekoPics[0]) 
              currentImage = nekoPics[1];
          else 
              currentImage = nekoPics[0];
          repaint();
          pause(150);
      }   
  }
      //neko stops and scratches in the middle of the panel twice
  private void scratch() {
      for (int i = 0; i &lt; 10; i++)  {
  
  
          // Swap images.
          currentImageIndex = nextImageList[currentImageIndex];
          currentImage = nekoPics[currentImageIndex];
  
  
              repaint();
              pause(150);
          }
  }
  //Neko runs to the end of the panel
  private void moveOut() {
      for (int i = xPos; i &lt; getWidth(); i+=10) {
          xPos = i;
          // swap images
          if (currentImage == nekoPics[0]) 
              currentImage = nekoPics[1];
  
          else 
              currentImage = nekoPics[0];
          repaint();
          pause(150);
      }   
  }
  </code></pre>