How to quickly set (copy and past?) tilemap terrain? – Help


Godot Version

4.2.1

Question

Hello ! I’m learning to use the new TileMap system of Godot 4, so far it’s pretty cool.
I have a first question regarding terrain system: I am using Tilesetter to quickly create an autotile for my project, Then, to properly use the autotile, I need to go to TileSet tab → select my Tileset → paint properties terrains then set terrains. I now have to paint the part of my terrain to use in the autotile, like in this screenshot:

Now, it is a tedious, weird process to paint this thing, and it’s especially frustrating because if you always use the same pattern for autotile, it’s basically always the same pattern to paint over, but it’s still long and confusing as you probably know. My question is simple: is there a way to not do it every time, and just save or copy/past the patten painted in another autotile into a new one? So far I have not found any way, but it seems like a logical thing to be able to do, since it’s basically always the same process (especially when you always use the same autotile pattern, which is most people’s case).

My second question is: is there a way to change the color of a tileset (not an entire tilemap, just a tileset)? I’d like to create some 1bit tilesets that are all gonna have white and as main color and then just change the color in code (a different one for each tileset).
I have not found any way to do so, weirly enough (might be because of the way tileset work?).

Thanks a lot for your help!

To answer the first part of your question, I totally agree with you. One of the first things I did when I moved to Godot 4 was make TileBitTools, which should do just what you’re looking for. It has preset templates, and you can also make your own. (It’s archived because I wasn’t planning on actively working on it anymore, but it works in 4.2 and I will give it a quick update if it breaks in the 4.3 beta.)

For the second part, you should be able change the color with the per-tile modulate setting. For multiple versions, you can make alternative tiles, or just import your same source image more than once. If modulate isn’t sufficient, you can programmatically get your source texture’s Image, duplicate it, make changes using Image’s methods, and resave it. If you need even more complex changes than that, you can programmatically put the texture in a TextureRect in a Subviewport, apply a shader, and then save the Subviewport’s texture to use for your new tiles.

The TileSets are very accessible to scripting in 4.x, so you can then transfer all your tiles’ settings to a new TileSet source via script if it will save you time.

The code in TileBitTools does some image manipulation to create the previews and then programmatically assigns the terrain bits, so feel free to use any parts of that code that are helpful.

Edited to better explain the image options.



1 Like



Source link

Leave a Comment