Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class TileLayerCollision
- Object
- TileLayerCollision
Converts between a drawn com.codename1.gaming.level.TileLayer and the
collision TileGrid the simulation reads.
A game painting its levels with an atlas keeps one table, “frame N of the
sheet is solid, frame M is a one-way ledge”, and derives the collision from
the art with #toGrid; a game that writes Tile characters derives the art
from the collision with #toLayer.
Methods
Inherited methods
Method details
toGrid
public static TileGrid toGrid(TileLayer layer, int[] frameKinds)Builds the collision grid for a tile layer.
Parameters
layerTileLayer- the drawn layer
frameKindsint[]- the
Tilekind of each sheet frame; frames past the end and empty cells areTile#EMPTY
Returns
a grid of the same size and tile size
toLayer
public static TileLayer toLayer(TileGrid grid, SpriteSheet sheet, int[] kindFrames)Builds a tile layer that draws a collision grid.
Parameters
gridTileGrid- the grid
sheetSpriteSheet- the tileset
kindFramesint[]- the sheet frame for each
Tilekind, indexed by kind; -1 or past the end draws nothing
Returns
the layer