Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public interface PlatformArt
Known subtypesProceduralArt
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.
Methods
public abstract Image tile(TileGrid grid, int col, int row) | The image for one cell. |
public abstract SpriteSheet sheet(Actor actor) | The sprite sheet for an actor; frames are chosen by #animator(Actor). |
public abstract ActorAnimator animator(Actor actor) | The animator for an actor. |
public abstract Image entity(LevelEntity entity, int tick) | The image for an entity this tick. |
public abstract Image platform(MovingPlatform platform) | The image for a moving platform. |
public abstract 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()). |
Method details
tile
public abstract 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
gridTileGrid- the grid, to look at neighbors for auto-tiling
colint- the column
rowint- the row
Returns
an image the size of a tile in pixels, or null to draw nothing
sheet
public abstract 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
actorActor- the actor;
Actor#getKind()names its art
Returns
the sheet
animator
public abstract ActorAnimator animator(Actor actor)The animator for an actor.
Parameters
actorActor- the actor
Returns
the animator, typically shared by every actor of a kind
entity
public abstract Image entity(LevelEntity entity, int tick)The image for an entity this tick. Called every tick, so return cached
images.
Parameters
entityLevelEntity- the entity;
LevelEntity#getType()andLevelEntity#getPhase()select the image tickint- the world tick, for animating
Returns
the image, drawn centered on the entity, or null to draw nothing
platform
public abstract Image platform(MovingPlatform platform)The image for a moving platform.
Parameters
platformMovingPlatform- the platform
Returns
an image the platform’s size in pixels
goal
public abstract 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
widthint- the goal’s width in pixels
heightint- the goal’s height in pixels
tickint- the world tick, for animating
Returns
the image, or null to draw nothing