Kinda new in Defold. Here’s a simple question:
What is easiest way to change text of the node by pressing, say, enter key.
As far as i understand, i should do next:
-
create .gui with text node
-
bind key_enter to action
-
create script file and add it to the go
-
add this line to init function (to listen to the input):
msg.post(".", “acquire_input_focus”) -
theeen, i don’t know, add this lines to on_input function:
if action_id == hash(“chtext1”) and action.value == 1 then
local node1 = gui.get_node(“text1”)
gui.set_text(node1, “changed text”)
end
it doesn’t work though. i think i fail to understand some core stuff here.
btw, chtext1 is my action name for enter key, text1 is text node name