Hi!
Everything is in the title
I think I know the answer, but I need to be sure before starting to test time-consuming solutions/workarounds.
Is there a way to sort z-values of each tile separately?
(if not possible… would be pretty convenient )
Hi!
Everything is in the title
I think I know the answer, but I need to be sure before starting to test time-consuming solutions/workarounds.
Is there a way to sort z-values of each tile separately?
(if not possible… would be pretty convenient )
No, I’m afraid not.
Ok thank you!
It was for that kind of situation (already mentioned in another post so I’m not surprised by the answer)
I think I’ll just add a custom property (ex: game object “ID”) to some tiles and spawn game objects over them to manage the z-order with the characters.
(but the feature mentioned above may still be interesting in the future )
Have you tried adding those “top” pieces in a different layer of the tilemap, with a higher z-value?
@Mathias_Westerdahl
It was my first move, but my map will be much bigger and probably “dynamically” generated (not sure about how to implement that… I’ll create a dedicated topic ), with the same objects, displayed many times:
Example of a “dungeon” built by the player (vertical growth always based on the same type of “rooms”):
I would need many, many layers to do what I have in mind… wouldn’t I?
So I thought that it would be way easier to spawn game objects over the tiles in question (with the exact same sprite so players won’t make the difference), and then just make sure they’re always over the characters.
I don’t think so?
my map will be much bigger and probably “dynamically” generated (not sure about how to implement that
The files are in text format, so should be easy to generate
If the player is always behind the tops of the pillars, then you just need one extra layer.
If the player can be in front of or behind them at different times, then you need game objects with some sort of dynamic Y-sorting.
I think there’s a couple threads about dynamic level generation. It’s as simple or as complex as you want it to be. Any tutorials for tile-based dungeons you find for other engines should also apply to Defold. You can change tilemaps dynamically however you want, you just…tilemap.set_tile()
. The only weird part with Defold is that you have to pre-set some tiles in the corners since it pre-allocates the bounds of the tilemap.
Yeah that was my concern… I may have some characters that will be big enough to be displayed behind AND in front of the “top pieces” mentioned above, but I can still change my mind.
If it appears to create a huge constraint (for a small benefit), I’ll give up the idea.
I suppose it doesn’t mean that I won’t be able to create “infinite” tilemaps? (even if the bounds are pre-allocated, I can dynamically increase the tilemap “inside the bounds”?)
I created a topic to shortly describe my use case, do you think you could take a quick look at it?
For now, my problem is more about how to create “sub-tilemap” (??) templates? (not even sure of what I’m talking about)
Anyway thanks of your answer, I’ll take a deeper look at everything available here and there about dungeon generation.
It doesn’t make much sense to create a tilemap of infinite size. I would suggest that you use a number of smaller tilemaps as the segments/chunks of the map nearest the player and update those as the player moves around on the map. I have an example similar to this here: https://github.com/britzl/publicexamples/tree/master/examples/infinite_map