1. Home
  2. Docs
  3. LDtk interface
  4. Auto layers

Auto layers

Auto-layers are actually based onIntGrid layers with a twist:they have a Tileset linked to them and rules to paint tiles automatically.

Creating an IntGrid auto-layer

Step 1 – Create a Tileset

You can use the free tilesetCavernas fromAdam Saltsmanfor your tests.

Open theTILESETSpanel
ClickCREATE TILESET
Import anIMAGE and adjust theGRID SIZE.

Step 2 – Create an IntGrid layer

Open theLAYERS panel
Create anINTGRID layer
Optionally, add some values
Select yourTILESET in theAUTO PAINT section

Step 3 – Add some rules

Click on the newRULES button in the layer list on the left.
Create a newRULE GROUP
Create a newRULE in this group

Important

There are actually 2 types ofauto-layers:

  • IntGrid layers with rules: just a normal IntGrid layer with a tileset attached, as shown above.
  • Pure auto-layers: this distinct layer type only containrules, and takes its source data from anotherseparate IntGrid layer. Pure auto-layers can be really useful if you want to render separate foreground and background layers using a single IntGrid source.

How rules work?

Here is the rule editor window:

Rules are grid patterns that will decide if a specific tile should be painted on your layer.

Here is a simple rule:

It says“Paint the tile on the left if” :

  1. in any given cell,there isa “collision” IntGrid value (white)
  2. ANDthere is nocollision” value above.

And here is another one:

This second one means: “Paint the tile on the left if any given grid cell contains a “collision” value“.

With these 2 rules, if you add collisions to your layer, the tiles will be drawn automatically:

If you pressSHIFT+R or uncheck theRender option in theRules panel, you will see the “pure” IntGrid layer, without the tiles: