So far I have made 4 basic images-tiles, from which I will fill the 2D world, they are void, dirt, water and sand. All of them are png and 32x32px in size. Information about them is stored on JSON-file and all pictures have their ID. I would like to generate tilesets based on all available images along with a texture atlas and use them later. How can this be done?
If you need to make this at runtime and use in a tilemap, probably the best way is to use the Image class and make your own texture at runtime when you know the tiles you want to make an atlas out of.
What you’d do is get the Image from the Texture2D you have as files after loading them:
Then you iterate over those pixels for each one you want to pack into the atlas using get_pixel, and then the atlas image you are creating would then set_pixel with the offsets you need to pack them the way you want, just offset the x and y indices to do that.