Interface PlatformArt

All Known Implementing Classes:
ProceduralArt

public interface PlatformArt

Supplies the images a PlatformView draws. The simulation never sees any of it, so art can change -- a skin, a seasonal theme, a 2.5D model set -- without changing how a level plays or what a replay hashes to.

ProceduralArt implements every method with generated shapes, so a level is playable before any art exists; extend it and override what you have art for.

  • Method Summary

    Modifier and Type
    Method
    Description
    animator(Actor actor)
    The animator for an actor.
    entity(LevelEntity entity, int tick)
    The image for an entity this tick.
    goal(int width, int height, int tick)
    The image for the level's goal this tick, drawn centered on the goal rectangle (PlatformWorld#getGoal()).
    The image for a moving platform.
    sheet(Actor actor)
    The sprite sheet for an actor; frames are chosen by #animator(Actor).
    tile(TileGrid grid, int col, int row)
    The image for one cell.
  • Method Details

    • tile

      Image tile(TileGrid grid, int col, int row)

      The image for one cell. Called when the view first draws a cell and again whenever the cell changes (a door opening, a block crumbling).

      Parameters
      • grid: the grid, to look at neighbors for auto-tiling
      • col: the column
      • row: the row
      Returns

      an image the size of a tile in pixels, or null to draw nothing

    • sheet

      SpriteSheet sheet(Actor actor)

      The sprite sheet for an actor; frames are chosen by #animator(Actor). The frame is drawn centered on the body horizontally and standing on its bottom edge, so a sheet may be larger than the body.

      Parameters
      • actor: the actor; Actor#getKind() names its art
      Returns

      the sheet

    • animator

      ActorAnimator animator(Actor actor)

      The animator for an actor.

      Parameters
      • actor: the actor
      Returns

      the animator, typically shared by every actor of a kind

    • entity

      Image entity(LevelEntity entity, int tick)

      The image for an entity this tick. Called every tick, so return cached images.

      Parameters
      • entity: the entity; LevelEntity#getType() and LevelEntity#getPhase() select the image
      • tick: the world tick, for animating
      Returns

      the image, drawn centered on the entity, or null to draw nothing

    • platform

      Image platform(MovingPlatform platform)

      The image for a moving platform.

      Parameters
      • platform: the platform
      Returns

      an image the platform's size in pixels

    • goal

      Image goal(int width, int height, int tick)

      The image for the level's goal this tick, drawn centered on the goal rectangle (PlatformWorld#getGoal()).

      Parameters
      • width: the goal's width in pixels
      • height: the goal's height in pixels
      • tick: the world tick, for animating
      Returns

      the image, or null to draw nothing