@britzl - hey thank you for the prompt replay and details here.
What you are proposing towards the end of your post is what I was thinking as well. I possibly need to come up with a way to represent classes of game objects as prefabs that I can’t then change at runtime as needed.
The kicker for me is that the engine (on top of Defold) that Im trying to build allows you to express complex hierarchies of objects using Lua. Here is an example of what you can do:
-- Excerpt from a Lua-like language
function makeButton(pos, text, code) {
local image = createImage(UI_SHEET, "panel_button")
imageAt(image, pos)
imageParentChild(options_image, image)
imageScale(image, 3.0)
local text_image = createTextImage(FONT_OPTIONS, text, ALIGN_CENTER)
imageAt(text_image, point(1,-3.5))
imageScale(text_image, 1.0)
imageParentChild(image, text_image)
createButton({"image": image}, image, options_image, @(data, event, pos, flags) {
if (event == BUTTON_EVENT_ENTER) {
imageWiggle(data.image, 0.25,1,2)
}
if (event == BUTTON_EVENT_UP) {
code()
}
})
return image
}
As you can imagine, the scripting engine allows one to build at runtime any arbitrary visual components with one or more sub componets setting properties as needed and even attaching button click callback events.
Now that I think about it I’m not sure Defold is a good fit for doing this type of thing.