Page 1 of 1

Access tiled property through main.lua

Posted: Tue Aug 15, 2017 1:58 am
by Beastinlosers

Code: Select all

properties = {},
  tilesets = {
    {
      name = "TileSet",
      firstgid = 1,
      tilewidth = 32,
      tileheight = 32,
      spacing = 0,
      margin = 0,
      image = "TileSet.png",
      imagewidth = 452,
      imageheight = 32,
      tileoffset = {
        x = 0,
        y = 0
      },
      properties = {},
      terrains = {},
      tilecount = 14,
      tiles = {
        {
          id = 12,
          properties = {
            ["collidable"] = "true"
          }
        }
      }
    },
How do I call

Code: Select all

["collidable"] = "true"
something like table.table.whatever . I'm using this to set up static walls. Would I just have a function called (for example) staticColliderLoad() and call that on love.load()? Then within staticColliderLoad() have an if statement that checks to see if if the area has that property, and if so, make it a wall? Then when the world loads up, the player (top down) cannot get through. Using box2d and the collider property was drawn out onto my map through tiled.