Class TileAnimationResolver

java.lang.Object
games.pixscape.runtime.tiled.animation.TileAnimationResolver

public final class TileAnimationResolver extends Object
  • Method Details

    • resolveVisualAssetId

      public static int resolveVisualAssetId(int assetId, int frameIndex, TileAnimationLookup lookup)
      Resolves the visual asset to display for a cell
      Parameters:
      assetId - logical asset stored in the map
      frameIndex - current frame index for this instance
      lookup - animation definitions lookup
      Returns:
      the visual asset to be rendered
    • isAnimated

      public static boolean isAnimated(int assetId, TileAnimationLookup lookup)
      Returns true if the asset matches a known animated tile.
    • frameCount

      public static int frameCount(int assetId, TileAnimationLookup lookup)
      Number of frames for this animated asset, 0 if not animated.
    • frameDurationMs

      public static int frameDurationMs(int assetId, int frameIndex, TileAnimationLookup lookup)
      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.