First of all please forgive me, as I only even heard of Defold yesterday. I have worked my way through the tutorials. I am a seasoned python programmer.
I am creating a simple GUI interface that will create a specific sprite depending on the key that is press. The key pressing delivers the correct key pressed, but I cannot work out how to spawn a specific sprite.
I have all the sprites loaded into a factory based on a prototype. I can spawn using the factory, but when the user presses a key, ALL the sprites spawned by the factory are generated and I cannot work out how to spawn just the sprite that I want to appear.
The code I am using is:
local component = “/createNumbers#numbersFactory”
factory.create(component, p)
This works, but displays ALL the sprites in the prototype.
Say I wanted to load a sprite in the game object prototype with an ID of 1. Is there any way of doing this?
local component = “/createNumbers#numbersFactory#1”
factory.create(component, p)
produces an error.
I don’t want to have to set up a prototype and factory for every single sprite, and I assume there is a better way of doing this?
The answer is probably really obvious, but as I said I only started with defold yesterday, so apologies again …