Class Layer
java.lang.Object
com.codename1.gaming.level.Layer
A named drawing band in a GameLevel: the editor's "Background / Terrain / Items /
Actors" rows, and the rendering order behind them.
A layer has a #getKind() -- Kind#TILE layers paint a grid of asset ids into
cells (stored as a "col,row" -> assetId map), while Kind#ENTITY and
Kind#MODEL layers just group freely-placed GameElements. #isVisible() and
#isLocked() mirror the editor toggles; #getBand() is the layer's slot in the
stack and is folded into the rendered z-order (band * 1000 + per-sprite z) so a
higher layer always draws over a lower one.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhat a layer holds, which decides how its content is realized. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcellKey(int col, int row) The cell key used in the tile map for a column and row.intgetBand()getKind()What this layer holds (Kind#TILE/Kind#ENTITY/Kind#MODEL).getName()floatThe horizontal parallax factor applied to every sprite realized from this layer (default1= scrolls with the world).floatThe vertical parallax factor for this layer (default1); see#getParallaxX().getTile(int col, int row) The asset id painted at a cell, or null if the cell is empty.booleanisLocked()booleanPaints an asset into a tile cell (no-op safety: a null assetId clears it).removeTile(int col, int row) setBand(int band) setKind(Layer.Kind kind) setLocked(boolean locked) setParallax(float x, float y) setVisible(boolean visible) tiles()The raw"col,row" -> assetIdmap for a tile layer.
-
Constructor Details
-
Layer
public Layer() -
Layer
-
-
Method Details
-
getName
-
setName
-
getKind
What this layer holds (Kind#TILE/Kind#ENTITY/Kind#MODEL). -
setKind
-
isVisible
public boolean isVisible() -
setVisible
-
isLocked
public boolean isLocked() -
setLocked
-
getBand
public int getBand() -
setBand
-
getParallaxX
public float getParallaxX()The horizontal parallax factor applied to every sprite realized from this layer (default1= scrolls with the world). A background layer of clouds/mountains uses a small factor (e.g.0.3) so it drifts behind the foreground as the camera scrolls. -
getParallaxY
public float getParallaxY()The vertical parallax factor for this layer (default1); see#getParallaxX(). -
setParallax
-
tiles
-
cellKey
The cell key used in the tile map for a column and row. -
putTile
-
getTile
The asset id painted at a cell, or null if the cell is empty. -
removeTile
-