Git Tilemap as image Block?

I would like a get tile map as image block so I could have a smaller tile map in the background in the distance wile playing my game.

1 Like

You can try loading the tilemap, creating an image the same size as the tilemap, and poop over every time and draw that tile to the image at the same coordinates. You need the sprite utils extension to draw the tile (which is just an image too!) to the destination image.

Note that this option will use a lot of memory, and the maximum size of an image is 512x512, so 512 (max image width/height) / 16 (default tile width/height) = max of 32 tiles width and height to fit in one image.

3 Likes

I’ve made a “convert tilemap to image” block recently in my game jam game ([Announcement] MakeCode Arcade Mini Game Jam #3 - Racing Jam - #41 by Kiwiphoenix364), but it may take a little bit of work to turn into an extension. If you give me a day or two, I’ll build it into an extension. Keep in mind that it is slow, and takes some time to convert, a 64x64 tilemap takes ~3-5 seconds to convert in the simulator. Also, images that are generated can be any size (4096x4096 literally works, the max size of a tilemap!), the issue is displaying it on-screen though (which the cap for sprites is 512x512 pixels, although I didn’t have to deal with that because of the renderer I was using, so levels are 1024x1024 pixels in that game!).

1 Like

@Lucas_M I made the extension! You can find it at
kiwiphoenix364/pxt-tilemap-image-converter
I hope you like it! It’s just a basic extension that I made in a couple of hours that takes in an image variable and a tilemap and makes that tilemap into an image!

1 Like