List of usage examples for com.badlogic.gdx.maps.tiled.tiles AnimatedTiledMapTile getProperties
@Override
public MapProperties getProperties()
From source file:com.stercore.code.net.dermetfan.utils.libgdx.maps.TileAnimator.java
License:Apache License
/** animates the {@link TiledMapTileLayer target layer} using the given animations * @param animations the animations to use * @param layer the {@link TiledMapTileLayer} which tiles to animate * @param animationKey the key used to tell if a tile is a frame * @param intervalKey the key used to get the animation interval (duration each frame is displayed) * @param defaultInterval the interval used if no value is found for the intervalKey */ public static void animateLayer(ObjectMap<String, Array<StaticTiledMapTile>> animations, TiledMapTileLayer layer, String animationKey, String intervalKey, float defaultInterval) { for (int x = 0; x < layer.getWidth(); x++) for (int y = 0; y < layer.getHeight(); y++) { Cell cell;// w ww. jav a 2s. c o m TiledMapTile tile; MapProperties tileProperties; if ((cell = layer.getCell(x, y)) != null && (tile = cell.getTile()) != null && (tileProperties = tile.getProperties()).containsKey(animationKey)) { AnimatedTiledMapTile animatedTile = new AnimatedTiledMapTile( getProperty(tileProperties, intervalKey, defaultInterval), animations.get(tileProperties.get(animationKey, String.class))); animatedTile.getProperties().putAll(tile.getProperties()); cell.setTile(animatedTile); } } }