0

I'd like to ask if its possible to load .terrain maps from "Tiled" in plain javascript without any frameworks or something...? Or do you recommend using another map editor supported by plain javascript on websites?

It will be used in canvas as a map for players to play in.

strangereu
  • 81
  • 1
  • 8

1 Answers1

0

Tiled supports saving and loading the map as a JSON file, which you can load in plain JavaScript with JSON.parse.

You can also save the Tiled map as JavaScript file. Then the data gets wrapped with some JavaScript code that can make it easier to use in a browser.

For easiest parsing, you'll want to make sure to use the "CSV" tile layer data format. But you'll still need to map the global tile IDs to the right tile from the right tileset (after clearing the tile flipping flags if you use that feature). See the TMX Map Format for how this works.

Thorbjørn Lindeijer
  • 2,022
  • 1
  • 17
  • 22