Class AnimatedTiledMapTile
- java.lang.Object
-
- com.badlogic.gdx.maps.tiled.tiles.AnimatedTiledMapTile
-
- All Implemented Interfaces:
TiledMapTile
public class AnimatedTiledMapTile extends java.lang.Object implements TiledMapTile
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.badlogic.gdx.maps.tiled.TiledMapTile
TiledMapTile.BlendMode
-
-
Constructor Summary
Constructors Constructor Description AnimatedTiledMapTile(float interval, Array<StaticTiledMapTile> frameTiles)Creates an animated tile with the given animation interval and frame tiles.AnimatedTiledMapTile(IntArray intervals, Array<StaticTiledMapTile> frameTiles)Creates an animated tile with the given animation intervals and frame tiles.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]getAnimationIntervals()TiledMapTile.BlendModegetBlendMode()TiledMapTilegetCurrentFrame()intgetCurrentFrameIndex()StaticTiledMapTile[]getFrameTiles()intgetId()MapObjectsgetObjects()floatgetOffsetX()floatgetOffsetY()MapPropertiesgetProperties()TextureRegiongetTextureRegion()voidsetAnimationIntervals(int[] intervals)voidsetBlendMode(TiledMapTile.BlendMode blendMode)Sets theTiledMapTile.BlendModeto use for rendering the tilevoidsetId(int id)voidsetOffsetX(float offsetX)Set the amount to offset the x position when rendering the tilevoidsetOffsetY(float offsetY)Set the amount to offset the y position when rendering the tilevoidsetTextureRegion(TextureRegion textureRegion)Sets the texture region used to render the tilestatic voidupdateAnimationBaseTime()Function is called by BatchTiledMapRenderer render(), lastTiledMapRenderTime is used to keep all of the tiles in lock-step animation and avoids having to call TimeUtils.millis() in getTextureRegion()
-
-
-
Constructor Detail
-
AnimatedTiledMapTile
public AnimatedTiledMapTile(float interval, Array<StaticTiledMapTile> frameTiles)Creates an animated tile with the given animation interval and frame tiles.- Parameters:
interval- The interval between each individual frame tile.frameTiles- An array ofStaticTiledMapTiles that make up the animation.
-
AnimatedTiledMapTile
public AnimatedTiledMapTile(IntArray intervals, Array<StaticTiledMapTile> frameTiles)
Creates an animated tile with the given animation intervals and frame tiles.- Parameters:
intervals- The intervals between each individual frame tile in milliseconds.frameTiles- An array ofStaticTiledMapTiles that make up the animation.
-
-
Method Detail
-
getId
public int getId()
- Specified by:
getIdin interfaceTiledMapTile
-
setId
public void setId(int id)
- Specified by:
setIdin interfaceTiledMapTile
-
getBlendMode
public TiledMapTile.BlendMode getBlendMode()
- Specified by:
getBlendModein interfaceTiledMapTile- Returns:
- the
TiledMapTile.BlendModeto use for rendering the tile
-
setBlendMode
public void setBlendMode(TiledMapTile.BlendMode blendMode)
Description copied from interface:TiledMapTileSets theTiledMapTile.BlendModeto use for rendering the tile- Specified by:
setBlendModein interfaceTiledMapTile- Parameters:
blendMode- the blend mode to use for rendering the tile
-
getCurrentFrameIndex
public int getCurrentFrameIndex()
-
getCurrentFrame
public TiledMapTile getCurrentFrame()
-
getTextureRegion
public TextureRegion getTextureRegion()
- Specified by:
getTextureRegionin interfaceTiledMapTile- Returns:
- texture region used to render the tile
-
setTextureRegion
public void setTextureRegion(TextureRegion textureRegion)
Description copied from interface:TiledMapTileSets the texture region used to render the tile- Specified by:
setTextureRegionin interfaceTiledMapTile
-
getOffsetX
public float getOffsetX()
- Specified by:
getOffsetXin interfaceTiledMapTile- Returns:
- the amount to offset the x position when rendering the tile
-
setOffsetX
public void setOffsetX(float offsetX)
Description copied from interface:TiledMapTileSet the amount to offset the x position when rendering the tile- Specified by:
setOffsetXin interfaceTiledMapTile
-
getOffsetY
public float getOffsetY()
- Specified by:
getOffsetYin interfaceTiledMapTile- Returns:
- the amount to offset the y position when rendering the tile
-
setOffsetY
public void setOffsetY(float offsetY)
Description copied from interface:TiledMapTileSet the amount to offset the y position when rendering the tile- Specified by:
setOffsetYin interfaceTiledMapTile
-
getAnimationIntervals
public int[] getAnimationIntervals()
-
setAnimationIntervals
public void setAnimationIntervals(int[] intervals)
-
getProperties
public MapProperties getProperties()
- Specified by:
getPropertiesin interfaceTiledMapTile- Returns:
- tile's properties set
-
getObjects
public MapObjects getObjects()
- Specified by:
getObjectsin interfaceTiledMapTile- Returns:
- collection of objects contained in the tile
-
updateAnimationBaseTime
public static void updateAnimationBaseTime()
Function is called by BatchTiledMapRenderer render(), lastTiledMapRenderTime is used to keep all of the tiles in lock-step animation and avoids having to call TimeUtils.millis() in getTextureRegion()
-
getFrameTiles
public StaticTiledMapTile[] getFrameTiles()
-
-