Tiled (Map Editor)

The place for any Hollywood tutorials
Post Reply
Bugala
Posts: 1168
Joined: Sun Feb 14, 2010 7:11 pm

Tiled (Map Editor)

Post by Bugala »

This is not actually a tutoria, but just thought to share knowledge about this, since others might find this useful too.

There is this Map Editor called "Tiled": http://www.mapeditor.org/


It has an option to Export your map file as .lua file.

This file will result in foloowing:

Code: Select all

return {
  version = "1.1",
  luaversion = "5.1",
  orientation = "orthogonal",
  width = 20,
  height = 11,
  tilewidth = 96,
  tileheight = 96,
  properties = {},
  tilesets = {
    {
      name = "isometric_grass_and_water",
      firstgid = 1,
      tilewidth = 96,
      tileheight = 96,
      spacing = 0,
      margin = 0,
      image = "Programs/Tiled/examples/isometric_grass_and_water.png",
      imagewidth = 256,
      imageheight = 384,
      properties = {},
      tiles = {}
    }
  },
  layers = {
    {
      type = "tilelayer",
      name = "Tile Layer 1",
      x = 0,
      y = 0,
      width = 20,
      height = 11,
      visible = true,
      opacity = 1,
      properties = {},
      encoding = "lua",
      data = {
        1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        1, 1, 1, 1, 3, 4, 1, 1, 1, 1, 1, 0, 3, 3, 3, 0, 0, 0, 0, 0,
        1, 1, 1, 1, 5, 6, 1, 1, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0,
        1, 1, 1, 1, 7, 8, 1, 1, 1, 1, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
        0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0,
        0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
      }
    }
  }
}

As Hollywood is based upon LUA, you can easily see how this is almost right away usable to any hollywood project.


Tiled has quite a lot of features in it on making your maps, and this was just example code of simple 1 layer 2 dimension map without any extras like tile properties, objects...
tolkien
Posts: 190
Joined: Sun Oct 17, 2010 10:40 pm
Location: Spain

Re: Tiled (Map Editor)

Post by tolkien »

Very interesting and usefull....Lets try it.
Post Reply