Access tiled property through main.lua

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Beastinlosers
Prole
Posts: 3
Joined: Mon Aug 14, 2017 10:53 pm

Access tiled property through main.lua

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 53 guests