by Jon (Updated on 2015-10-20)
What are the building blocks of a scene? The scene’s terrain or “land” is typically made up of Tiles. Much like the tiles on your kitchen counter or bathroom, Tiles in a game are uniformly sized pieces of land that conform to a grid.
This article will cover the basics of importing and working with tiles.
Go to this menu item: File > Create New > Tileset
You'll now see this window.
Click Choose Image to pick out the tile sheet you want to import. (You can also copy it to the clipboard and paste it in.)
Pick out the Tile Width/Height. This will determine how your tile sheet is cut up. In most cases, this is 32x32 or 16x16.
The spacing and border fields are for cases where your tiles are spaced apart. This is rare.
Now, you'll see the main page for your newly imported Tileset.
The Tileset Editor is split into two parts.
On the left is the tileset itself and controls for rearranging it.
Now that you've uploaded your tileset, you will want to set the collision shapes for your tiles. You can either...
Picking a shape is simple - just click on any entry within the Collision Bounds pane. This even works when multiple tiles are selected (click and drag to select multiple tiles in the left pane).
If you prefer to make a custom shape, click the + button. You'll get a choice between creating a box (rectangle) or a convex polygon.
To learn more about tile collision shapes and how to define custom shapes, view our Setting Tile Collision Shapes article.
Some games use Animated Tiles to bring a scene to life. Here's how you convert a plain tile to an animated one.
Open up a Tileset.
Click on the Tile you'd like to animate in the left pane.
From this point, it's the same process and user interface as working with Actor Animations. As a refresher, you...
You can alter a tileset's row and column count by clicking directly on the row and column headers.
You may add additional tiles to a tileset after the initial import.
For best results, we recommend importing using an image that is the same width as the existing tileset, so additions don't get "offset" and break the layout.
For example, if your tileset is 6 columns wide, ensure that what you are importing is also 6 columns wide.
You can drag and drop tiles to rearrange them. Here's how.
1) With the Select Tiles mode active, select the tile(s) you wish to move. In this example, we've selected some tiles in row 1.
2) Now, switch to the Move Tiles mode.
3) Drag and drop your selection to the desired location. This will perform a swap between the tiles you have selected and the tiles in the desired location.
In this example, we've moved the tiles 3 positions over from their original position.
You can select multiple tiles at a time by clicking and dragging a box over those tiles. What's the use of this?
You can edit multiple collision bounds at the same time, a major time saver. As described above, you can also move/rearrange multiple tiles at a time.
This allows you to make visual tweaks to the tileset without having to reimport everything or manually edit the image from the game's directory.
You can tag tiles with textual data that can be accessed during game. For example, a lava tile could convey that it's deadly to the touch, or a healing tile in an RPG could heal the character passing over it.
To access this data from a behavior, you can use one of two methods.
Use the data for tile block under Scene > World > Tile API.
If you've worked with mobile games, you'll know by now that all graphics should be imported at quadruple the standard resolution, in order to support larger resolution displays and tablets.
Tilesets follow this same rule.
Import Tilesets at 4x the native resolution.
Example: For example, if your game's regular tile size is 32 x 32, you should import a tile sheet where the tiles are 128 x 128 and specify that you are importing at 4x. The Tile Size is kept at 32 x 32.
Keep the tile size for all tilesets and scenes the same. For example, if your tilesets have a tile size of 32 x 32, make sure that the scenes also have a tile size of 32 x 32.
When defining custom polygon shapes for Tiles, you can only use convex polygons. If you need to make a concave polygon, use multiple tiles to achieve this.
What if you want to change a scene's terrain at runtime? For example, you're making a game with automatically-generated dungeons. Use the Tile API, a special set of blocks, to accomplish this.