Hi! I'm not sure if this question has been asked previously but if I have an object layer with tiles indicating entities (for visibility), is it possible to remove or hide those tiles after the entities have been loaded? Looking through the exported raw lua of the map, I can see these are contained in an "objectgroup" layer alongside other objects like points and rectangles (which can be toggled visible or not visible as expected), yet their draw function does not seem to be related to those. Replacing the layer draw callback or even removing them from layer.objects doesn't seem to do anything to stop them from being drawn.
e.g. say I have an object layer foo with tile object bar, and ingame I use it to instantiate "bar_thing" and want to now remove or hide bar from foo.
Are they drawn to a permanent canvas somewhere or something? I can't seem to find them anywhere in the map generated by STI - dumping the map.layer[foo].objects table, and the map.objects table, allows me to locate bar, but dumping the map.tiles table does not provide any identifying info.
Simple Tiled Implementation - STI v1.2.3.0
Re: Simple Tiled Implementation - STI v1.2.3.0
There is no permanent canvas or the likes. Are you using collisions at all? Perhaps they are being added to your bump/box2d world and then they are being drawn using those plugins' draw calls (usually only used for debugging)?
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v1.2.3.0
I just was coming back to edit/post that I figured it out. It was the SpriteBatches (which, I have to realize, was talked about JUST the page before, sorry about that). Thanks for the rapid response!
For anyone interested my code for "disappearing" the tile items in question is as follows. Remaking the SpriteBatch won't be necessary in my case as individual scenes will be relatively small anyway, so this is a quicker solution for me:
Code: Select all
--somewhere above; everytime I grab the item info from the object in question I added object.delete = true
--L = layer
--self.activemap is the map instance created by STI
local newobjectlist = {}
for i=1,#L.objects do
local obj = L.objects[i]
if not L.objects[i].delete then
newobjectlist[#newobjectlist+1] = L.objects[i]
else
local batch = self.activemap.tileInstances[obj.gid][1].batch --pertinent info for tileInstances is hardcoded to [1]
local id = self.activemap.tileInstances[obj.gid][1].id
batch:set(id, 0, 0, 0, 0, 0) --set the sprite in the batch to have equal vertices, causing the GPU to not render it
end
end
L.objects = newobjectlist --compress the layer object list to remove those object instances
Re: Simple Tiled Implementation - STI v1.2.3.0
THANK YOU SO MUCH FOR THIS! I've just started working with STI and was stuck with this error but your tip helped me making my map to work!pauljessup wrote: ↑Tue Apr 05, 2022 1:57 pm Okay, I got a response- what you need to do now in version 1.8 is go to preferences, click on "Embed Tilesets on Export". It doesn't allow you to embed a tileset directly in the map anymore in the editor, it's only done on export.
Re: Simple Tiled Implementation - STI v1.2.3.0
thanks for thispauljessup wrote: ↑Tue Apr 05, 2022 1:57 pm Okay, I got a response- what you need to do now in version 1.8 is go to preferences, click on "Embed Tilesets on Export". It doesn't allow you to embed a tileset directly in the map anymore in the editor, it's only done on export.
saved a newbie's life
-
- Prole
- Posts: 3
- Joined: Thu Sep 01, 2022 7:48 pm
- Location: Somewhere in the Bri'ish lands
- Contact:
Re: Simple Tiled Implementation - STI v1.2.3.0
I've been trying to load my map using STI however when I run Map:draw() the map is missing 2 columns on the right and 1 row on the bottom (see image). How would I go around fixing this?
Extra Info, .love file and Image linked in this thread: viewtopic.php?f=4&t=93712
Extra Info, .love file and Image linked in this thread: viewtopic.php?f=4&t=93712
Re: Simple Tiled Implementation - STI v1.2.3.0
Does it work with Tiled 1.9? Or are you still recommending Tiled 1.2.x? (that's what I read on the repo)
Quick edit: I know it works with 1.9, I made a basic map and compiled it, just I want to know if there's some features of Tiled that are not supported here and I'm better off with 1.2
Quick edit: I know it works with 1.9, I made a basic map and compiled it, just I want to know if there's some features of Tiled that are not supported here and I'm better off with 1.2
Re: Simple Tiled Implementation - STI v1.2.3.0
I don't think the author is monitoring this thread; I'd advise to contact him though other means.Nawias wrote: ↑Wed Sep 14, 2022 7:06 pm Does it work with Tiled 1.9? Or are you still recommending Tiled 1.2.x? (that's what I read on the repo)
Quick edit: I know it works with 1.9, I made a basic map and compiled it, just I want to know if there's some features of Tiled that are not supported here and I'm better off with 1.2
That being said, I am using Tiled 1.2 just in case, but I didn't really have issues with 1.9
Re: Simple Tiled Implementation - STI v1.2.3.0
Actually, after checking https://thorbjorn.itch.io/tiled I can tell that there are certainly features that are not supported. For example, I can't find a 'type' or 'class' property for objects. Likewise, the site tells that the terrain definition changed in Tiled 1.5, so I suppose that old terrains won't load.
-
- Party member
- Posts: 356
- Joined: Wed Jul 03, 2013 4:06 am
Re: Simple Tiled Implementation - STI v1.2.3.0
Type and class are supported, I use them a hell of a lot. It's part of the table for the object when it's brought in. Here's an example-
Code: Select all
for i,v in ipairs(self.objects) do
if v.class=="streetLamp" then
---Do something here
end
end
Who is online
Users browsing this forum: Ahrefs [Bot] and 6 guests