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

grid TileGrid
the grid, to look at neighbors for auto-tiling
col int
the column
row int
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

actor Actor
the actor; Actor#getKind() names its art

Returns

the sheet

animator

public abstract ActorAnimator animator(Actor actor)
The animator for an actor.

Parameters

actor Actor
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

entity LevelEntity
the entity; LevelEntity#getType() and LevelEntity#getPhase() select the image
tick int
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

platform MovingPlatform
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

width int
the goal’s width in pixels
height int
the goal’s height in pixels
tick int
the world tick, for animating

Returns

the image, or null to draw nothing