# Class Layer

java.lang.Object
com.codename1.gaming.level.Layer

public class Layer extends Object

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 `GameElement`s. `#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 Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `Layer.Kind`
  What a layer holds, which decides how its content is realized.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Layer()`
  `Layer(String name, Layer.Kind kind)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `cellKey(int col, int row)`
  The cell key used in the tile map for a column and row.
  `int`
  `getBand()`
  `Layer.Kind`
  `getKind()`
  What this layer holds (`Kind#TILE` / `Kind#ENTITY` / `Kind#MODEL`).
  `String`
  `getName()`
  `float`
  `getParallaxX()`
  The horizontal parallax factor applied to every sprite realized from this layer (default `1` = scrolls with the world).
  `float`
  `getParallaxY()`
  The vertical parallax factor for this layer (default `1`); see `#getParallaxX()`.
  `String`
  `getTile(int col, int row)`
  The asset id painted at a cell, or null if the cell is empty.
  `boolean`
  `isLocked()`
  `boolean`
  `isVisible()`
  `Layer`
  `putTile(int col, int row, String assetId)`
  Paints an asset into a tile cell (no-op safety: a null assetId clears it).
  `Layer`
  `removeTile(int col, int row)`
  `Layer`
  `setBand(int band)`
  `Layer`
  `setKind(Layer.Kind kind)`
  `Layer`
  `setLocked(boolean locked)`
  `Layer`
  `setName(String name)`
  `Layer`
  `setParallax(float x, float y)`
  `Layer`
  `setVisible(boolean visible)`
  `Map<String,String>`
  `tiles()`
  The raw `"col,row" -> assetId` map for a tile layer.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Layer

    public Layer()

  - ### Layer

    public Layer(String name, Layer.Kind kind)

- ## Method Details

  - ### getName

    public String getName()

  - ### setName

    public Layer setName(String name)

  - ### getKind

    public Layer.Kind getKind()
    What this layer holds (`Kind#TILE` / `Kind#ENTITY` / `Kind#MODEL`).

  - ### setKind

    public Layer setKind(Layer.Kind kind)

  - ### isVisible

    public boolean isVisible()

  - ### setVisible

    public Layer setVisible(boolean visible)

  - ### isLocked

    public boolean isLocked()

  - ### setLocked

    public Layer setLocked(boolean locked)

  - ### getBand

    public int getBand()

  - ### setBand

    public Layer setBand(int band)

  - ### getParallaxX

    public float getParallaxX()
    The horizontal parallax factor applied to every sprite realized from this layer (default `1` = 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 (default `1`); see `#getParallaxX()`.

  - ### setParallax

    public Layer setParallax(float x, float y)

  - ### tiles

    public Map<String,String> tiles()
    The raw `"col,row" -> assetId` map for a tile layer.

  - ### cellKey

    public static String cellKey(int col, int row)
    The cell key used in the tile map for a column and row.

  - ### putTile

    public Layer putTile(int col, int row, String assetId)
    Paints an asset into a tile cell (no-op safety: a null assetId clears it).

  - ### getTile

    public String getTile(int col, int row)
    The asset id painted at a cell, or null if the cell is empty.

  - ### removeTile

    public Layer removeTile(int col, int row)