Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
NightKawata
Party member
Posts: 294
Joined: Tue Jan 01, 2013 9:18 pm
Location: Cyberspace, Room 6502
Contact:

Re: Simple Tiled Implementation - STI v0.14.1.12

Post 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.
"I view Python for game usage about the same as going fishing with a stick of dynamite. It will do the job but it's big, noisy, you'll probably get soaking wet and you've still got to get the damn fish out of the water." -taylor
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.12

Post by Karai17 »

There is none. With Lua you can require a directory if that directory has an init.lua in it.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
zugende
Prole
Posts: 12
Joined: Sun Feb 21, 2016 5:47 pm

Re: Simple Tiled Implementation - STI v0.14.1.12

Post by zugende »

Ahhh, thanks NightKawata and Karai17. I did not thought of that.

Thanks again,
zugende
premek
Prole
Posts: 21
Joined: Mon Dec 28, 2015 12:44 am
Contact:

Re: Simple Tiled Implementation - STI v0.14.1.12

Post 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
User avatar
Rishavs
Party member
Posts: 103
Joined: Sat Oct 17, 2009 5:29 am
Contact:

Re: Simple Tiled Implementation - STI v0.14.1.12

Post by Rishavs »

Hi quick question

Any idea how can I dump the stitched tilemap into an image/texture ?
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.12

Post by Karai17 »

draw the whole map to a large canvas then save the canvas
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
zugende
Prole
Posts: 12
Joined: Sun Feb 21, 2016 5:47 pm

Re: Simple Tiled Implementation - STI v0.14.1.12

Post 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 99 times
Thanks a lot for your help!!
Best
zugende
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.14.1.12

Post 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
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
zugende
Prole
Posts: 12
Joined: Sun Feb 21, 2016 5:47 pm

Re: Simple Tiled Implementation - STI v0.14.1.12

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

Re: Simple Tiled Implementation - STI v0.14.1.12

Post 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.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests