title: Textures to texture atlas and animation
body: <p>I think the loading of many textures in my animation cause the slight lag in my game, and i want my array textures to in a TextureAtlas. The code below is my animation code and also it will get the Texture frame index in the animation and perform a task if the texture index is shown...., I already have a .pack file named shot.pack for texture atlas but i didn't know how to apply it and make it like this. I hope someone can help</p>
  
  <pre><code>     Texture[] shot;
       //At CONSTRUCTOR
      shot = new Texture[21];
      for(int i=0; i &lt;21; i++){
          if(i == 19 || i==20 ){
              shot[i]=new Texture("s18.png");
          }
          else {
              shot[i] = new Texture("s" + Integer.toString(i) + ".png");
          }
  
      }
          //animation
      animation = new Animation(1/19f,shot);
  
  
     //@render METHOD
     sb.draw((Texture) animation.getKeyFrame(timePassed, false), ShootingTreys.WIDTH * 0.03f, ShootingTreys.HEIGHT * 0.03f, (ShootingTreys.WIDTH * 1 / 6), (ShootingTreys.HEIGHT / 2) + (ShootingTreys.HEIGHT * 0.13f));
  
          if (animation.getKeyFrameIndex(timePassed) == 20) {
              isShotDelay = true;
              shotDelay += Gdx.graphics.getDeltaTime();
  
              if (shotDelay &gt;= 0.2f || ball.getBall().getY() &lt; ShootingTreys.HEIGHT * 0.2f) {
                  touch = false;
                  timePassed = 0;
                  shotDelay = 0;
                  isShotDelay = true;
                  //for missed ball
                  colide = false;
              }
          }
  </code></pre>