Seeing available nodes during level construction

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Diet Estus

I am working on setting up a good flow for level creation.

I have created a few different wall nodes of different sizes. For example, I have WallChunk32x32, WallChunk64x32, and so on. These wall nodes are basically just StaticBody2Ds. I have very many different chunks.

When I’m designing a level in the editor, ideally, I’d like to be able to see all the chunks available and just click to add them to the scene. This would be easier than having to manually add the appropriate node to the scene every time I need one.

I tried adding all the chunks into their own scene called WallSet, then loading that scene into the level I’m designing. I expected that I could just look over to the set of available pieces, click to duplicate them, then drag them to where I want them.

Unfortunately, this is not allowed, even if I make children of WallSet editable.

I know that I can manually add all the pieces whenever I start creating a level, then just duplicate them as I need them. But this is more tedium than I want.

So, my question: What is the easiest way to get the kind of level construction flow that I want? That is, seeing my build set, and clicking on the piece I want to add to my scene?

I may be able to convert my WallSetinto a tileset and then use a TileMap node in my level, but is it possible to create a tileset out of StaticBody2Ds of various sizes?

:bust_in_silhouette: Reply From: hilfazer

Yes, tiles of same tileset can have different sizes. If what you need is just a StaticBody2D then Tileset should be what you need.

Be aware of limitations of tiles. Tiles are not nodes. Now you only need StaticBodies2D but you may need something more in the future, something tiles can’t do.
Fortunately it is possible to write a script that will replace tiles with nodes upon loading a level.

Remember to lock your Tilemaps after creating them so you won’t be accidentally selecting them.

Another thing to remember: order of nodes in your scene that will be made into tileset will be used by Tilemaps to refer to tiles. Tilemaps use indices, not names, so if order of your tiles change tiles on tilemap will also change.

I have an old Godot 2 project where i use tileset
I have tiles with different sizes of StaticBodies2D.

I also have a script to replace tiles with nodes. It’s there
There’s a useful function in Tileset - find_tile_by_name().

Thanks for your response. I have converted my WallSet.tscn (consisting of a parent Node with my custom wall nodes as children) into a tile set (called tile_set.tres). But when I load the tile set in a TileMap node in my level, I don’t see the tiles. Any idea why this might be happening?

Diet Estus | 2018-05-13 22:42

Do you have Tilemap selected? If tilemap is locked it needs to be selected in “Scene” window.

Are your nodes of Sprite type with texture selected? Looks like it’s neccesary.

hilfazer | 2018-05-14 16:32