A level made of separate block objects is painful to build and slow to play. A tile map is the opposite: one object, one image, and a grid you paint on. This guide covers the whole feature — the two size settings everybody gets caught by, the four things a tile can be, and the one habit that saves you rewriting your scripts later.
Add a Tile Layer component to an empty object. Give it a tileset image, set Tile size (pixels in the image) and Cell size (units in the world), then paint. Mark which tiles are Solid and the collision builds itself.
What a tile layer actually is
One object. That object holds a grid, and each square of the grid — a cell — remembers which tile from your image belongs there. Empty cells cost nothing.
This matters more than it sounds. Fifty crates built as fifty sprite objects is fifty objects for the engine to track, fifty colliders, and fifty things to select by hand when you want to move the floor down a bit. The same fifty crates painted onto a tile layer are one object, a handful of collision shapes, and a two-second edit.
Step 1: add the component
Create a new empty object, tap Add Component, choose Tile Layer. Nothing appears yet — you have an empty grid.
Name the object something you will recognise in a script later: ground, walls, water. You will need that name.
Step 2: the two sizes
This is the part that catches people, so it is worth thirty seconds.
- Tile size — how big one tile is inside the image file, in pixels. If your tileset is a grid of 16×16 tiles, this is 16. Get it wrong and the tiles will look sliced, showing bits of their neighbours.
- Cell size — how big one tile is in the game, in world units. This is a completely separate number.
They are separate on purpose. Pixel art is usually drawn small — 16×16 — but you rarely want it on screen at 16 units, because that is tiny on a phone. Setting Tile size 16 and Cell size 32 draws each tile at double size, crisp, with no change to the artwork. Want the whole level bigger? Change Cell size. The art never moves.
Step 3: paint
Pick a tile from the palette and drag across the grid. Drag with the eraser to clear cells. Dragging quickly is fine — the brush fills in the cells between two points, so a fast swipe does not leave a dotted line.
Build the shape of the level first and worry about which tiles are solid afterwards. It is much easier to judge a level when you can see it.
Step 4: decide what each tile does
A freshly painted tile is decoration. It draws, and nothing else — the player walks straight through it. That is deliberate: most of the tiles in a good-looking level are background, and background should never collide with anything.
Open the tile palette and give the tiles that need it a behaviour. There are four:
- Decoration (the default) — draws only. Backgrounds, floor patterns, wall decals, distant scenery.
- Solid — blocks from every side. Ground, walls, crates.
- One-way — solid from above, passable from below. Jump up through it and land on top. Wooden platforms, ledges.
- Trigger — reports a collision but stops nothing. Water, spikes, lava, pickup zones — anything a script should react to but that should not block movement.
Set a tile to Solid and every cell you have already painted with it becomes solid immediately, along with every one you paint later. You never mark cells one at a time. If you want two visually identical blocks where one is solid and one is not, use two different tiles.
Step 5: one object per kind of thing
This is the habit worth forming now, because retrofitting it is annoying.
When something collides with a tile layer, the collision is reported under the layer object's name. So if your ground and your lava are painted onto the same Tile Layer, every collision says the same thing, and no script can tell whether the player just landed on a floor or fell into lava.
Split them. A typical platformer wants three or four tile layer objects:
background— decoration only, no behaviours.ground— the solid tiles and one-way platforms.hazards— triggers: water, spikes, lava.
Now Is colliding with hazards means exactly one thing, and your damage script is two blocks long.
Why tile maps are fast
Before the game starts, Max2D looks at all your solid cells and merges neighbours into as few rectangles as it can. A floor a hundred cells wide becomes one collision rectangle. A room becomes four. The physics engine is doing a fraction of the work it would do with individual block objects, which is why a tile level runs smoothly on a phone where hundreds of crates would not.
You do not have to do anything to get this. It is worth knowing only because it explains the one limit: a deliberately checkerboarded map — solid, gap, solid, gap — cannot merge at all and is the one shape to avoid at very large sizes. Ordinary levels are nowhere near any ceiling.
Changing tiles while the game runs
Two blocks turn a static level into a reactive one:
- Set tile — paints or erases one cell mid-game. Setting a tile below zero erases it, so “place a block” and “destroy a block” are the same block with a different number.
- Get tile — reads one cell into a variable. It stores
-1where the map is empty, so “is there ground below me?” is an ordinary comparison rather than a special feature.
Both can work in world coordinates as well as grid coordinates, which means you can hand them a position instead of counting cells. “Break the block just below me” is one Set tile with your own position in it.
That is the whole basis of a digging game, destructible cover, bridges that build themselves as you approach, and doors that dissolve when you have the key.
Both of these are free projects you can import and pull apart:
How to make a digging game — destructible terrain with Set tile, and why the digging needs a speed limit.
How to make a stealth game — guards whose line of sight is blocked by walls, using Get tile.
When it doesn't behave
- The player falls through the floor. The tiles are still decoration. Set them to Solid in the tile palette — painting alone never creates collision.
- Tiles look sliced or show fragments of other tiles. Tile size does not match the tileset image. Count the pixels of one tile in the file and use that number.
- The level is the wrong scale. That is Cell size, not Tile size. Cell size changes how big tiles are in the world; Tile size only tells the engine how to cut up the image.
- My script can't tell water from ground. They are on the same layer object. Split them onto two Tile Layer objects with different names.
- The layer won't rotate. Tile layers do not rotate, by design — the grid is the grid. Rotate the camera or the objects on top of it instead.
Frequently asked questions
What is a tile map in Max2D?
A Tile Layer is a component you add to one object. It holds a grid of cells, and each cell says which tile from your tileset image goes there. One object with a tile layer can be an entire level — hundreds of blocks — instead of hundreds of separate sprite objects. It is faster to build, far faster to run, and much easier to edit.
What is the difference between Tile size and Cell size?
Tile size is measured in the image: how many pixels across one tile is inside your tileset file, usually 16 or 32. Cell size is measured in the game world: how big that tile is once it is on screen. They are deliberately separate. A 16 pixel tile drawn at a 32 unit cell is normal and looks crisp — it is simply drawn at double size. Change Cell size to scale the whole level without touching the artwork.
How do I make tile map walls solid?
Painting a tile does not make it solid — by default every tile is decoration and the player walks straight through. Open the tile palette, pick the tile, and set its behaviour to Solid. Every cell already painted with that tile becomes solid at once, and so does every cell you paint with it afterwards. The behaviour belongs to the tile, not to the cell.
How do I make a one-way platform?
Set the tile's behaviour to One-way. You can jump up through it from below and then land on top of it, which is exactly how platforms work in most platformers. You do not need a script and you do not need a separate object — paint a row of one-way tiles and they behave correctly straight away.
Why can't a script tell my water apart from my walls?
Because they are on the same layer. Collision reports the layer object's name, so if your water tiles and your wall tiles live on one Tile Layer, every collision just says "terrain" and no script can tell which one it touched. Put hazards on their own Tile Layer object with its own name. This is the single most useful habit with tile maps: one object per kind of thing, not one object for the whole level.
Are tile maps slow if the level is big?
No, and that is the main reason to use one. Max2D merges neighbouring solid cells into as few collision rectangles as it can before the game starts — a hundred-cell floor becomes one rectangle, not a hundred. A level that would be hundreds of separate objects ends up as a handful of shapes. Very large or deliberately checkerboarded maps can hit an internal ceiling on collision shapes, but an ordinary hand-painted level is nowhere near it.
Can I change tiles while the game is running?
Yes. Set tile paints or erases one cell mid-game, and Get tile reads one back. That is how destructible terrain, digging, bridges that build themselves and doors that open are made. Set tile can take world coordinates, so "break the block just below me" is one block with your own position in it.