title: Creating a method containing image imported from files
body: <p>I wanted to create method out of <code>//create textures</code> section to shorten the <code>run()</code> , but if I do and pass the images from <code>//import</code> section as arguments, then call it like: </p>
  
  <p><code>createTextures(texture, texture2,ballTextureImport, greenFlashImport, blueFlashImport);</code></p>
  
  <p>the method drawGraphics can't see them.</p>
  
  <p><code>drawGraphics()</code> is just repeated <code>add(everyParameter);</code></p>
  
  <p>Here's part of the code inside <code>run()</code>:</p>
  
  <pre><code>    // import
      Image texture = getImage(getCodeBase(), "texture.png");
      Image texture2 = getImage(getCodeBase(), "texture2.png");
      Image ballTextureImport = getImage(getCodeBase(), "ballTexture.png");
      Image greenFlashImport = getImage(getCodeBase(), "greenFlash.png");
      Image blueFlashImport = getImage(getCodeBase(), "blueFlash.png");
  
      // create textures
      GImage paddleLeftTexture = new GImage(texture);
      GImage paddleRightTexture = new GImage(texture2);
      GImage ballTexture = new GImage(ballTextureImport);
      GImage greenFlash = new GImage(greenFlashImport, -250, 0);
      GImage blueFlash = new GImage(blueFlashImport, -250, 0);
      paddleLeftTexture.setSize(WIDTH + 1, HEIGHT + 1);
      paddleRightTexture.setSize(WIDTH + 1, HEIGHT + 1);
      ballTexture.setSize(BALL_SIZE, BALL_SIZE);
      greenFlash.setSize(100, 300);
      blueFlash.setSize(100, 300);
  
      // make objects
      GOval ball = makeBall();
      GRect paddleLeft = makePaddle();
      GRect paddleRight = makePaddle();
  
      drawGraphics(ball, paddleLeftTexture, paddleRightTexture, ballTexture,
              greenFlash, blueFlash, counter, paddleLeft, paddleRight,
              aiScore, playerScore);
  </code></pre>
  
  <p>the remaining arguments from <code>drawGraphics()</code> are created earlier in <code>run()</code> and in <code>//make objects</code> and look fine (are not underlined in red).</p>