Page 8 of 92

Re: Simple Tiled Implementation - STI v0.6.14

Posted: Wed Feb 19, 2014 12:09 pm
by Durandle
This seems to be something mentioned before, but is there any reason you don't have a direct tile-id to tile-properties lookup table? It seems like something that would be super useful, since when doing a collision check with a tile/object, you may want to check for example the "solid" property of said tile. Or the "reactive" property" Or the "bouncy" property. etc etc etc. Sure I've written my own lookup code, that makes such a table, but seems like something that really should be in-built (and if it is, its not documented).

That being said, this is such a useful module :) and really fast to boot.

Re: Simple Tiled Implementation - STI v0.6.14

Posted: Wed Feb 19, 2014 4:09 pm
by Karai17
There is a direct lookup!

Code: Select all

local map = sti.new("map")
print(map.tiles[1234].properties)
If you check out my other lib linked in my sig (Peep), then you can more easily view table data to see what potentially undocumented things are lurking about. :)

Thank you for your kind words, I'm glad people are finding my lib useful! :D

Re: Simple Tiled Implementation - STI v0.6.14

Posted: Wed Feb 19, 2014 6:59 pm
by pauljessup
Any way we can change the setColor RGB values called before each tile is drawn? For tile based lighting, for example.

Re: Simple Tiled Implementation - STI v0.6.14

Posted: Wed Feb 19, 2014 11:05 pm
by Karai17
Not that I am aware of. You could try using a shader, maybe?

Re: Simple Tiled Implementation - STI v0.6.14

Posted: Wed Feb 19, 2014 11:18 pm
by davisdude
You could add it as a function, couldn't you? Seems like it would be easy to me. :P

Re: Simple Tiled Implementation - STI v0.6.14

Posted: Wed Feb 19, 2014 11:42 pm
by Karai17
All the tiles are in sprite batches and are all drawn at once, so it wouldn't really work the way you want it to.

Re: Simple Tiled Implementation - STI v0.6.14

Posted: Thu Feb 20, 2014 1:23 am
by qwook
What about this function?
https://love2d.org/wiki/SpriteBatch:setColor

The lighting thing should really be handled by shaders though.

Re: Simple Tiled Implementation - STI v0.6.14

Posted: Thu Feb 20, 2014 1:38 am
by Karai17
That seems to be only used when adding a new sprite to the batch, not something you'd use dynamically to adjust lighting. I would recommend using a shader for lighting effects.

Re: Simple Tiled Implementation - STI v0.6.14

Posted: Thu Feb 20, 2014 7:06 am
by micha
Haven't tried myself, but it seems with SpriteBatch:setColor you can assign a color to each quad in the batch. First call setColor and after that use "set" on a quad. If I understand the wiki correctly, then this should also change the color.

Re: Simple Tiled Implementation - STI v0.6.14

Posted: Thu Feb 20, 2014 10:02 am
by qwook
micha wrote:Haven't tried myself, but it seems with SpriteBatch:setColor you can assign a color to each quad in the batch. First call setColor and after that use "set" on a quad. If I understand the wiki correctly, then this should also change the color.
That's the exact thing I posted and Karai answered it directly above your post.