Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
OtherCannon
Prole
Posts: 8
Joined: Mon Dec 30, 2019 1:09 am

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by OtherCannon »

in case the images didn't work here's the link to the bool:
https://love2d.org/imgmirrur/oEY5eqF.png
and the border issue
https://love2d.org/imgmirrur/h1ZZM6U.png
I be developing stuff.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

Hm... very strange. Are you using a release version of STI or the master branch in github?
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
OtherCannon
Prole
Posts: 8
Joined: Mon Dec 30, 2019 1:09 am

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by OtherCannon »

I'm using a release version, 1.2.3
I be developing stuff.
OtherCannon
Prole
Posts: 8
Joined: Mon Dec 30, 2019 1:09 am

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by OtherCannon »

Okay I just cloned the latest version from the github, problem is still there though.
I be developing stuff.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

can you send me a .love file that i can test with?
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
OtherCannon
Prole
Posts: 8
Joined: Mon Dec 30, 2019 1:09 am

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by OtherCannon »

I pmed you the sample.love of my game
I be developing stuff.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

For your collision issue, I don't think you're actually adding the player to your physics world. box2d_init parses the map into a physics world, but you will need to then add your player to that world manually. I believe the process here is to create a new fixture and shape but it's been a while since I've looked too deeply at box2d. Some example code that may help is here: https://github.com/karai17/Simple-Tiled ... ua#L46-L66

I will note that if you plan to do more simple collision detect/rejection and don't need to actually simulate physics, the bump plugin is probably a better fit. It deals with efficiently colliding axis-aligned boxes instead of a full simulation.

As for why it's drawing strangly... I suspect that's a bug in the plugin that I will have to deal with. It may have something to do with the "infinite map" feature you're using, perhaps unknowly? If you switch your map in Tiled to have a fixed size, it might fix that bug. Let me know if it does and I'll try to address it.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
ikarius
Prole
Posts: 3
Joined: Fri Feb 21, 2020 12:08 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ikarius »

Hi there,

I'm quite new to STI and I'm currently using it successfully to create maps with some collision inside (with Box2d).

A quick question though: after init, when I have loaded and displayed all the layers, it is a good idea to "update" a layer to add some collidable tiles ?

I want to add new static and collidable elements, maybe animatable.

I'm trying to do something like:

Code: Select all

map:setLayerTile("walls", gx, gy, tileid)
but it does not work (crash)

I tried adding the tileid in the

Code: Select all

data
object of the layer, itdoes not work either (no crash, but may need some call to update).

Is it a good approach or should I use a custom layer (just as in the tutorial for sprites) ?

Thanks in advance
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

Once you init the collision world, you'd need to add new collision data to the world manually. You can swap tiles in and out of layers visually, but no collision data will be added by doing that. Basically, STI provides a graphical representation of your physics world, but they are otherwise independant systems.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
ikarius
Prole
Posts: 3
Joined: Fri Feb 21, 2020 12:08 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ikarius »

Thanks for your quick reply.

I succeeded adding static components by creating custom layers and adding manually all needed physics, so I think I am on the good path.

But I'm creating a lot of custom layers (one per static object). Is it OK to create a layer for every object in the game ?

Plus, I don't know how to change the tile in a given layer: I can replace any tile with an ID=0 and it removes it correctly.
But adding another tile ID is a no go (crash).
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 12 guests