Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.8

Post by Karai17 »

Use object layers for that, not tile layers.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
premek
Prole
Posts: 21
Joined: Mon Dec 28, 2015 12:44 am
Contact:

Re: Simple Tiled Implementation - STI v0.14.1.8

Post 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)
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.8

Post by Karai17 »

Use ipairs, it is way faster. Also make sure to remove the object from map.objects
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
premek
Prole
Posts: 21
Joined: Mon Dec 28, 2015 12:44 am
Contact:

Re: Simple Tiled Implementation - STI v0.14.1.8

Post 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)
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.8

Post by Karai17 »

Pass in the whole layer, not just the objects.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
premek
Prole
Posts: 21
Joined: Mon Dec 28, 2015 12:44 am
Contact:

Re: Simple Tiled Implementation - STI v0.14.1.8

Post 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!
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.8

Post by Karai17 »

Ah, right. Confusing :p
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Rishavs
Party member
Posts: 103
Joined: Sat Oct 17, 2009 5:29 am
Contact:

Re: Simple Tiled Implementation - STI v0.14.1.8

Post by Rishavs »

Any chance of staggered isometric support? :cry:
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.8

Post by Karai17 »

Sti already supports that.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Rishavs
Party member
Posts: 103
Joined: Sat Oct 17, 2009 5:29 am
Contact:

Re: Simple Tiled Implementation - STI v0.14.1.8

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

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests