Tileset and tiles
A tile is a small block of scenery: a piece of floor, of wall, of grass. A tileset is the collection of tiles, and a Tiles layer is where you paint with them. It is the way to build a level without creating an object for every block.
Creating a tileset
Section titled “Creating a tileset”- Import the image as a sprite. In Recursos, import the PNG with all the tiles side by side.
- Slice it to the tile size. In the sprite editor, slice the image (for example, 16 × 16 frames). Each frame of the sprite will be a tile.
- Create the tileset. In Recursos, click + and choose Novo tileset… (new tileset). In the tab that opens, choose the Sprite.
The tiles are numbered like the frames of the sprite: from left to right, top to bottom, starting at 0.
The collision of each tile
Section titled “The collision of each tile”In the tileset tab, the Colisão (collision) section has three options under Pintar (paint). Choose one and click the tiles (drag to get several):
- Nada (nothing): the tile does not block. That is the case for decorations, like a flower.
- Célula (cell): the tile blocks on the whole cell, like an object with Sólido (solid) checked.
- Forma (shape): the tile blocks only where it has artwork. A thin platform gets a thin collision, and you can pass under it.
The Aplicar a todos (apply to all) button puts the chosen option on the whole tileset at once. To adjust one tile, click it: the Tile section shows the Posição (position) and the Tamanho (size) of the collision box, and on the enlarged tile you can drag to draw another box.
Painting in the room
Section titled “Painting in the room”- In the Camadas panel, click + Camada and choose Tiles.
- With the layer active, the Inspector shows the palette. Click a tile.
- Click and drag in the room to paint.
| Tool | Shortcut | What it does |
|---|---|---|
| Pincel (brush) | B | Paints with the chosen tile |
| Borracha (eraser) | E | Erases. The right button always erases, with any tool |
| Balde (bucket) | G | Fills the continuous area |
| Eyedropper | Alt + click | Picks the tile that is in the room |
- Drag on the palette to choose a block of tiles and paint with all of it, like a stamp.
- Each stroke is one Ctrl+Z step.
- The tile grid starts at the corner of the room and uses the tile size.
Collision
Section titled “Collision”In the layer’s Inspector, Colide (collides) turns collision on: the solid tiles start to count in placeFree, moveAndStop and onGround, the same way a solid object does. On a decoration-only layer, turn it off.
For the player to walk on the tiles, the code is the same as always. See Platformer.
Terrain brush
Section titled “Terrain brush”Painting corners and edges one by one gets tiring. A terrain solves that: it is a block of 3 × 3 tiles in the tileset, with the four corners, the four edges and the middle.
- In the tileset tab, in the Terrenos (terrains) section, click + Terreno and give it a name.
- Click the tile at the top-left corner of the 3 × 3 block. The yellow outline shows the block.
- In the room, with the Tiles layer active, choose the terrain under Terreno, in the Inspector.
Now the brush paints “there is ground here”, and the editor picks the right tile by itself, looking at the neighbors. The eraser also fixes the edges around it.
Limits of this version
Section titled “Limits of this version”- Tiles do not change while the game is running.
- There are no animated, mirrored or rotated tiles.
- A platform you can jump through from below is not a kind of tile: it is made with an object and code.
