public SampleMoveValidator(TileMap map) {
   this.tileMap = map;
   ArrayList<TileMapLayer> layers = map.getLayers();
   for (TileMapLayer tileMapLayer : layers) {
     if (tileMapLayer.getName().equals("meta")) {
       collision = tileMapLayer;
     }
   }
   this.tileHeight = tileMap.getTileheight();
   this.tileWidth = tileMap.getTilewidth();
 }
 public boolean isBlocked(int tileIndex) {
   if (collision == null) {
     return false;
   }
   Tile tile = tileMap.getTile(collision.getGid(tileIndex));
   if (tile == null) {
     return false;
   }
   Properties properties = tile.getProperties();
   if (properties == null) {
     return false;
   }
   String collidable = tile.getProperties().getProperty("collidable", "false");
   if (collidable.equals("true")) {
     return true;
   }
   String hatRequired = tile.getProperties().getProperty("hatRequired", "false");
   if (hatRequired.equals("true")) {
     return !heroHasHat;
   }
   return false;
 }
 public int tileIndex(int x, int y) {
   return x + (y * tileMap.getWidth());
 }