Page 81 of 92

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Sat Feb 15, 2020 3:29 pm
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

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Sun Feb 16, 2020 7:51 am
by Karai17
Hm... very strange. Are you using a release version of STI or the master branch in github?

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Sun Feb 16, 2020 2:23 pm
by OtherCannon
I'm using a release version, 1.2.3

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Mon Feb 17, 2020 1:34 am
by OtherCannon
Okay I just cloned the latest version from the github, problem is still there though.

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Mon Feb 17, 2020 3:44 am
by Karai17
can you send me a .love file that i can test with?

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Mon Feb 17, 2020 3:42 pm
by OtherCannon
I pmed you the sample.love of my game

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Thu Feb 20, 2020 1:01 pm
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.

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Fri Feb 21, 2020 1:13 pm
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

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Fri Feb 21, 2020 1:47 pm
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.

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Fri Feb 21, 2020 2:39 pm
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).