Doubt with Tiled object layout

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
User avatar
AdrianN
Citizen
Posts: 73
Joined: Wed Mar 28, 2018 5:13 pm
Location: Lima

Doubt with Tiled object layout

Post by AdrianN »

Hi all, I'm new in the forum, sorry for my bad english (google translate).
I have a doubt with object layout (tiled)
I create my stage and collidable ground (I used STI library) and work fine.
But I have no idea to get value (point=1) and hide object layout (bones).

I tried to edit the library but I do not know where to start.

Edit:
Get the point value from the lua map and accumulate and hide the bone (object layout).
Is posible with STI library or another library?



Edit 2:
I tried to edit bump.lua from STI and print value to console

Code: Select all

if layer.type == "objectgroup" then
	for _, obj in ipairs(layer.objects) do
		if layer.properties.collidable == true or obj.properties.collidable == true then
				--some stuff
		end
		if layer.properties.point==10 or obj.properties.point==10 then -- bone value
			if obj.shape == "rectangle" then
				local t= {
					x 		   = obj.x + map.offsetx,
					y          = obj.y + map.offsety,
					width      = obj.width,
					height     = obj.height,
					layer      = layer,
					properties = obj.properties.point
					}
					print(t.properties)
					table.insert(collidables, t)
			end
		end
	end
end
Result:

value:10
value:10
value:10
value:10
....

Forestn.lua (map)

Code: Select all

return{
      -- bone code
      name = "bone",
      firstgid = 181,
      tilewidth = 32,
      tileheight = 32,
      spacing = 0,
      margin = 0,
      image = "bone.png",
      imagewidth = 32,
      imageheight = 32,
      tileoffset = {
        x = 0,
        y = 0
      },
      grid = {
        orientation = "orthogonal",
        width = 32,
        height = 32
      },
      properties = {},
      terrains = {},
      tilecount = 1,
      tiles = {
        {
          id = 0,
          properties = {
            ["point"] = 1
          }
        }
      }
    }
Images

Image
Image
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 16 guests