Page 42 of 92

Re: Simple Tiled Implementation - STI v0.14.1.8

Posted: Mon Dec 28, 2015 2:41 am
by Karai17
Use object layers for that, not tile layers.

Re: Simple Tiled Implementation - STI v0.14.1.8

Posted: Mon Dec 28, 2015 12:27 pm
by premek
Karai17 wrote:Use object layers for that, not tile layers.
Ok, I changed my map to use object layer, it looks better. But I still have the same problem with removing objects from map at runtime. I ended up with following, but how would you do it better?

Thanks!

Code: Select all

-- layer is called "objects"; item is the one to be removed (collected)
for k,v in pairs(self.map.layers.objects.objects) do
    if v.id == item.id then
        table.remove(self.map.layers.objects.objects, k)
    end
end
self.map:setObjectSpriteBatches(self.map.layers.objects)

Re: Simple Tiled Implementation - STI v0.14.1.8

Posted: Mon Dec 28, 2015 12:33 pm
by Karai17
Use ipairs, it is way faster. Also make sure to remove the object from map.objects

Re: Simple Tiled Implementation - STI v0.14.1.8

Posted: Mon Dec 28, 2015 1:00 pm
by premek
Karai17 wrote:Use ipairs, it is way faster. Also make sure to remove the object from map.objects
OK, but I still need to call `setObjectSpriteBatches`, right? Is this the correct way?
thanks

Code: Select all

        for k,v in ipairs(map.layers.objects.objects) do
          if v.id == item.id then
            table.remove(map.layers.objects.objects, k)
          end
        end
        table.remove(map.objects, item.id)
        map:setObjectSpriteBatches(map.layers.objects)

Re: Simple Tiled Implementation - STI v0.14.1.8

Posted: Mon Dec 28, 2015 1:05 pm
by Karai17
Pass in the whole layer, not just the objects.

Re: Simple Tiled Implementation - STI v0.14.1.8

Posted: Mon Dec 28, 2015 1:14 pm
by premek
Karai17 wrote:Pass in the whole layer, not just the objects.
it is the layer, it is called "objects" so I guess it is ok. Thanks for your help!

Re: Simple Tiled Implementation - STI v0.14.1.8

Posted: Mon Dec 28, 2015 1:15 pm
by Karai17
Ah, right. Confusing :p

Re: Simple Tiled Implementation - STI v0.14.1.8

Posted: Wed Dec 30, 2015 7:45 am
by Rishavs
Any chance of staggered isometric support? :cry:

Re: Simple Tiled Implementation - STI v0.14.1.8

Posted: Wed Dec 30, 2015 8:12 am
by Karai17
Sti already supports that.

Re: Simple Tiled Implementation - STI v0.14.1.8

Posted: Wed Dec 30, 2015 10:44 am
by Rishavs
Can you check my map once? I need a wee bit of help.
Also, you said that the draw range support is only for ortho currently.
Rishavs wrote:Hi

I seem to have hit an issue with your lib.

For isometric Staggered map, it is only displaying 21, 21 tiles.

I am attaching the map i used.

my code is here

https://github.com/rishavs/RoguishLove/

and the file where all the map stuff happens is src/_state_Game.lua