Help creating clones of sprites

I don’t know how to create clones of sprites, I tried searching on the documentation but nothing comes up if you search clone or clones.

Hi Orange
What do you mean by clones of sprites? if you are looking for instantiating objects maybe using factory and factory.create() is your solution.
you can check this example as well.


If you mean cloning sprites in the editor, then you can copy and paste them just like you would any other app, by selecting the sprite in the editor’s Outline view, pressing “command C”, and then pressing “command V” in the place you want to clone it to, which may be the same exact place in which case you can just immediately press it.

If you mean cloning a sprite itself during a game, I’d recommend looking into packing the sprite into a modular game object which you can spawn with Defold factories as Navid stated, or in uncommon or uncertain instances where you just need to clone a specific sprite you can probably make a more dynamic factory that takes the parameters of the attributes of the GO and sprite you need.

If it is a GUI node which you therefore cannot use normal GO methods such as factory, go.set(), etc then you can use gui.clone()

1 Like