Builds a tilemap from a target image and tile image(s)
According to the specifications of the tiled format, tiles can be mirrored vertically, horizontally, and diagonally
import { make_json_tiled_map_from_image } from "./index.js"
import fs from 'node:fs'
const target_image_path = "./test-assets/cavesofgallet.png"
const tile_width = 8
const tile_height = 8
const tiles_image_paths = [
"./test-assets/cavesofgallet_tiles_a.png",
"./test-assets/cavesofgallet_tiles_b.png",
]
const map = make_json_tiled_map_from_image(target_image_path, tiles_image_paths, tile_width, tile_height)
fs.writeFileSync("output.tiled.map.json", JSON.stringify(map))node src/cli.js reverse 8 8 target.png target.png > tilemap0.json
node src/cli.js simplify tilemap0.json > tiles.png
node src/cli.js reverse 8 8 target.png tiles.png > tilemap.json
- run
make_json_tiled_map_from_imageusing the target image as tile image
Then, in order to reduce tile image to only used tiles
- run
make_png_of_used_tilesto produce an image of unique tiles
Then
- run
make_json_tiled_map_from_imageon the initial target image, this time using the tile image produced by step 2
(c) 2024 lespin, GNU GENERAL PUBLIC LICENSE v3
Assets are public domain
retrieved 28/02/2024 at https://adamatomic.itch.io/cavernas
"Based on GHOST CROQUET, Celeste, Iconoclasts, and Bitsy. The download includes around 100 tiles so far, as well as a reference image to see how they can be used. These assets are public domain and free to use on whatever you want, personal or commercial. Enjoy <3"