Class TileLayer
java.lang.Object
com.codename1.gaming.level.TileLayer
An efficient, single-tileset tile grid: a #getCols() x #getRows() array of frame
indices into one SpriteSheet (-1 means "empty cell").
This is the fast representation a game uses when every tile comes from the same
atlas -- contrast with a Layer of Layer.Kind#TILE, which stores an
assetId-per-cell map and can mix assets from different packs. #toScene(Scene, int) materializes the non-empty cells as Sprites anchored at their top-left at
tileSize spacing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetCols()intgetRows()getSheet()intgetTile(int col, int row) The frame index painted at a cell, or -1 if empty.intsetTile(int col, int row, int frame) Paints a frame index into a cell (-1 clears it).voidAdds aSpritefor every non-empty cell to the scene, anchored at the cell's top-left corner and z-ordered atzOrder.
-
Constructor Details
-
TileLayer
-
-
Method Details
-
getCols
public int getCols() -
getRows
public int getRows() -
getTileSize
public int getTileSize() -
getSheet
-
getTile
public int getTile(int col, int row) The frame index painted at a cell, or -1 if empty. -
setTile
Paints a frame index into a cell (-1 clears it). -
toScene
Adds aSpritefor every non-empty cell to the scene, anchored at the cell's top-left corner and z-ordered atzOrder.
-