I’m using a tile map layer to create a world for a 2D Zelda-like game (seen from above). I want to create a sort of teleport between cells: when standing over one cell, the player gets automatically transported to the other. Ideally I would like to be able to specify both ends of the portal directly on the tile map (layer) on the editor (e.g., the destination coordinates for the other ‘side’ of the portal).
I know that I can add custom information to a tile set, but that would imply creating a new tile type for every single portal position. That’s very cumbersome.
The ideal workflow would be to click on a tile over the tile map layer, have a place with “custom” data specific to that tile, and add the information there.
I haven’t been able to find anything like this, have I missed something?
There are some solutions of how I have come up:
Every tile has its own data
In this situation, you should not place responsibility on the tile map. Instead, use a separate grid to store the map, and visualize it in the tile map by setting the tiles. After all, rendering and defining physics behaviors (such as collision shapes) is what tile maps are supposed to do.
Some of the tiles need to be marked
You could consider taking a not-so-good (yeah, looks weird) method. Initialize them at runtime, unfortunately, I couldn’t find a way to set it in the editor either.
I developed a level editor (which exports .tscn
files) in my platformer, so I planned editing levels in-game after completing the editor.
Thanks for your reply.
After all, rendering and defining physics behaviors (such as collision shapes) is what tile maps are supposed to do.
Yeah, I get the impression that the TileMapLayer is mostly meant for side scrollers and not top-down. For example, I don’t need physics and terrains at all.
So far I have two layers: one shows the terrain (water, mountain, etc.) and the other I use for meta information: player and creatures starting positions, and the mark “portals”. Then I store in code a list of portals, specifying for each the coordinates. This works but it’s a pity that I cannot “mark” directly over the tile map where a portal should take me to.
I didn’t quite get it. I mean, it’s great for top-down, you can paint it in the editor, or generate the tiles in runtime (like Minecraft chunks). This reminds me of the dual-grid system.
I haven’t looked at this latest incarnation of TileMaps in GODOT.
Unless this aspect has been changed then you still need physics to enable collisions on Tiles.
I don’t need collisions.
In the end, I decided to have 4 special tiles (portal 1 to 4) that I place around the map in pairs, one for each entry/exit point of the portal. I scan the used tiles when I load the level and store a reference to each pair. This means I have a hard limit of only 4 portals per level (which of course I could increase to many more), but it works and I can still use the tile editing functionality.
It would be great, though, if each Tile in the map could have a dictionary of arbitrary data that I can modify through the editor.