title: how to check collision of tiles and how to add conditions on them using java and libgdx
body: <pre><code>for(Rectangle tile: tiles) {
      if(koalaRect.overlaps(tile)) {
          // we actually reset the koala y-position here
          // so it is just near the tile we collided with
          // this removes bouncing :)
          if(koala.velocity.y &gt; 0) {
              koala.position.y = tile.y - Koala.HEIGHT;
              // we hit a block jumping upwards, let's destroy it!
              TiledMapTileLayer layer = (TiledMapTileLayer)map.getLayers().get(1);
              layer.setCell((int)tile.x, (int)tile.y, null);
          } else {
              koala.position.y = tile.y + tile.height;
              // if we hit the ground, mark us as grounded so we can jump
              koala.grounded = true;
          }
          koala.velocity.y = 0;
          break;
      }
  }
  </code></pre>
  
  <p>this code is from superkoala.</p>
  
  <p>what i want is when the koala/hero collides with the wall/tile it checks the tile. then i want to change the tile into 3 forms. a solid tile, a slightly cracked tile, a very fragile tile and finally destroy it.</p>
  
  <p>example </p>
  
  <pre><code>switch(layer){
  "SolidLayer": TiledMapTileLayer layer = (TiledMapTileLayer)map.getLayers().get(3);
  //get cracked tile
  layer.setCell((int)tile.x, (int)tile.y, null);
  "CrackLayer": TiledMapTileLayer layer = (TiledMapTileLayer)map.getLayers().get(2);
  //get fragile tile
  layer.setCell((int)tile.x, (int)tile.y, null);
  "FragileLayer": TiledMapTileLayer layer = (TiledMapTileLayer)map.getLayers().get(1);
  //get destroyed layer
  layer.setCell((int)tile.x, (int)tile.y, null);}
  </code></pre>
  
  <p>is this possidle?</p>