Page 46 of 92

Re: Simple Tiled Implementation - STI v0.14.1.12

Posted: Sat Mar 19, 2016 12:26 am
by NightKawata
I usually download the repo into a folder called "sti," and with Lua, you can actually just require "sti" and it'll automatically find an init.lua file for ya.

You can do that with folders as long as you've got an init.lua inside of one!
So yeah, just grab that repo, drop it into a folder name of your choice, and just require it up, dog!

Good luck out there.

Re: Simple Tiled Implementation - STI v0.14.1.12

Posted: Sat Mar 19, 2016 7:31 am
by Karai17
There is none. With Lua you can require a directory if that directory has an init.lua in it.

Re: Simple Tiled Implementation - STI v0.14.1.12

Posted: Sat Mar 19, 2016 8:00 am
by zugende
Ahhh, thanks NightKawata and Karai17. I did not thought of that.

Thanks again,
zugende

Re: Simple Tiled Implementation - STI v0.14.1.12

Posted: Sun Mar 20, 2016 2:12 pm
by premek
zugende wrote:Hi everyone,
not sure If i missed something..but I can't find the sti.lua file. Can someone help me? :crazy:
Thaaanks a lot!
Best
Basti
Hi, I think you need to download everything into a folder called "sti" and then use it like this:
local sti = require "sti"
or
local sti = require "lib.sti"
if you have your sti folder in lib folder and so on

Re: Simple Tiled Implementation - STI v0.14.1.12

Posted: Thu Apr 07, 2016 8:32 am
by Rishavs
Hi quick question

Any idea how can I dump the stitched tilemap into an image/texture ?

Re: Simple Tiled Implementation - STI v0.14.1.12

Posted: Thu Apr 07, 2016 12:14 pm
by Karai17
draw the whole map to a large canvas then save the canvas

Re: Simple Tiled Implementation - STI v0.14.1.12

Posted: Sat Apr 09, 2016 10:02 pm
by zugende
Hi everybody,

I want to update a tile but can't get it to work. What am I missing?
When mouse clicked, this code is fired(line 77):

Code: Select all

map.layers[1].data[tiley][tilex].gid = 9
Now, when I click again I can see that the gid changed correctly to 9 but the image is not updated..why?
tile_test.love
Simple STI test. (Warning: messy code)
(69.49 KiB) Downloaded 100 times
Thanks a lot for your help!!
Best
zugende

Re: Simple Tiled Implementation - STI v0.14.1.12

Posted: Sat Apr 09, 2016 10:04 pm
by Karai17
You need to update the spirit batch. Instead of changing the gid, you want to update the whole tile using the tiles table, then update the sprite batch

Re: Simple Tiled Implementation - STI v0.14.1.12

Posted: Sun Apr 10, 2016 9:56 am
by zugende
Karai17 wrote:You need to update the spirit batch. Instead of changing the gid, you want to update the whole tile using the tiles table, then update the sprite batch
Thx for the fast response. But I guess I need some further help with that. :P

I can imagine that I need to use

Code: Select all

map.tileInstances[i][id].batch
and something like this

Code: Select all

map.layers[1].data[tiley][tilex] = map.tiles[id]
in order to get it work. But I somehow cant get it to work. Can you give me an example Karai17? :ultraglee:

Thanks a lot!
zugende

Re: Simple Tiled Implementation - STI v0.14.1.12

Posted: Sun Apr 10, 2016 9:59 am
by Karai17
Looks like you mostly have it. I think the batch id should be in the tile instance, so that will tell you exactly which part of the batch you need to update.