Dynamic atlas change?

Did some research, and it seems like dynamic atlas changing is in this year’s roadmap. So maybe there’s some other way, or maybe it’s been already released and I missed that.

I’am filling an isometric tilemap (room) with instances (furniture) of a default GO with a sprite (atlas and animation defined in editor). While all objects in the room are static and use the same atlas, doors use their own atlases with animations (opening). And it seems like I can’t just set_atlas(object, atlas) for now. Most likely there’s another way. How can I do that? GUI sprites?

Thanks!

1 Like

We are releasing resource properties in the next release (in a week). I will make a post about it tomorrow so that people can try it and give feedback.

7 Likes

You can’t just use a separate game object for your doors?

2 Likes

Defold team, you’re awesome!)

3 Likes

Thanks! Sure, that’s what I’ll do. But still we have a location with 5-10 rooms, and each room has it’s own atlas with floor texture and objects as sprites. There’s always only one room on your screen at a time, so map re-initiates each time character moves from one room to another. I.e. we need to change atlas anyway.

1 Like

Is there now a way to generate atlas dynamically?

I have a Spine character, I’d like to be able to generate infinite combinations of this character, based on a set of separate PNGs that I’d like to build the atlas with.

Has anyone done it? Do you know if it’s possible to do it within the Defold?

You can modify/change the contents of an existing atlas at runtime. BUT for this to be useful you also need to know which part of the atlas to change. So you either have to hardcode this or also include the original .atlas file as a custom resource and load and parse it to know the location within the atlas.

I believe @Pkeod created an example of how to do this for a sprite. The principle is the same for the atlas used by a Spine model.

Here’s one forum thread and a solution by @Pkeod : Dynamic creation of the atlas in the script - #26 by Pkeod (there are probably more threads discussing this)

If you can settle for less than infinite then there’s also the spine skin functionality (spine.set_skin()) where you can change the image used by one part of a model.

2 Likes

Thanks for your response.
I found a way using skins!

2 Likes