Class TileAnimationResolver
java.lang.Object
games.pixscape.runtime.tiled.animation.TileAnimationResolver
-
Method Summary
Modifier and TypeMethodDescriptionstatic intclampFrameIndex(int frameIndex, int frameCount) Bounds a frameIndex to the valid interval.static intframeCount(int assetId, TileAnimationLookup lookup) Number of frames for this animated asset, 0 if not animated.static intframeDurationMs(int assetId, int frameIndex, TileAnimationLookup lookup) Duration of the current frame, or 0 if asset is not animated / invalid index.static booleanisAnimated(int assetId, TileAnimationLookup lookup) Returns true if the asset matches a known animated tile.static intnextFrameIndex(int frameIndex, int frameCount) Move to the next frame with a loop.static intpreviousFrameIndex(int frameIndex, int frameCount) Goes to the previous frame with a loop.static intresolveVisualAssetId(int assetId, int frameIndex, TileAnimationLookup lookup) Resolves the visual asset to display for a cell
-
Method Details
-
resolveVisualAssetId
Resolves the visual asset to display for a cell- Parameters:
assetId- logical asset stored in the mapframeIndex- current frame index for this instancelookup- animation definitions lookup- Returns:
- the visual asset to be rendered
-
isAnimated
Returns true if the asset matches a known animated tile. -
frameCount
Number of frames for this animated asset, 0 if not animated. -
frameDurationMs
Duration of the current frame, or 0 if asset is not animated / invalid index. -
clampFrameIndex
public static int clampFrameIndex(int frameIndex, int frameCount) Bounds a frameIndex to the valid interval. -
nextFrameIndex
public static int nextFrameIndex(int frameIndex, int frameCount) Move to the next frame with a loop. -
previousFrameIndex
public static int previousFrameIndex(int frameIndex, int frameCount) Goes to the previous frame with a loop.
-