A Gradle plugin and command line utility for packing individual tile images into tilesets.
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'org.mini2Dx:tilepacker-gradle-plugin:4.2.0'
}
}
Then define a task for packing up your tiles into tilesets. The tilesDirectory is where your tiles and configuration file are.
task tilePack(type: org.tilepacker.gradle.TilePackerTask) {
tilesDirectory file("path/to/tiles/folder")
//Change to true if you do not want to use previously stored order of tiles
rewrite false
}
Then run the task with the --no-daemon
option.
gradle tilePack --no-daemon
A sample configuration file can be found here.
On the command line, the application takes a single argument - the path to the directory of the tiles and configuration file. The configuraiton file tells tilepacker which settings to apply and which files to pack into tilesets.
A sample configuration file can be found here.
Windows
tilepacker-core.bat ./path/to/tiles/folder
Mac OS X / Linux
./tilepacker-core ./path/to/tiles/folder
tileWidth
- The width of each tile in pixelstileHeight
- The height of each tile in pixelstilesetWidth
- The width of each tileset in pixelstilesetHeight
- The height of each tileset in pixelsoutputFormat
- The output image format (PNG or JPG)tiles
- The list of relative paths to tile images to be packed
tilePadding
- The padding in pixels to apply around each tile (0 by default)preventTearing
- If you want to prevent tearing when scaling rendering, TilePacker can pad out each tile by its border pixels (false by default)premultiplyAlpha
- If you want the output image to have premultiplied alpha values (false by default)backgroundColor
- The background color to use in output imagesgroupTilesByDirectory
- True if tiles should be grouped into multiple tilesets based on their directory
Older integrated graphics cards can only load textures of 512x512 pixels so it is recommended that tilesets are generated at this maximum size if you wish to support older cards.