Is it possible to build an atlas at runtime? (edit: or Tiling map)

Imagine I have a texture and I want to define the regions of sprites and IDs at runtime, is this possible from Lua?

For example a real game case would be a tiling puzzle, where I can use the same image for several levels of difficulty by subdividing the image at run-time.

2 Likes

Making a tile sliding game with multiple images changed at runtime would be possible now if the size of the textures are exactly the same. Look up resource.set_texture()

You can also modify texture data at runtime, but you can’t edit the UVs/sprite animation yet. https://github.com/subsoap/imagebatch/blob/master/imagebatch/image_controller.script

Looks like simply I can’t do it with Defold, becasue I don’t want to replace a texture to existing UVs, but define the UVs to existing or reloaded textured.

I need what Corona does with newImageSheet, load the image and define the regions: https://docs.coronalabs.com/api/library/graphics/newImageSheet.html

1 Like

Yep, maybe it will come in a future update like the resources one we’ve heard about… we’ll have to hope and see and continued to be vocal about what’s needed.

3 Likes