Issue with a button in my gui (SOLVED)

#1

Hi, I’m actually learning defold game engine. I started with the Climberz example, trying to add a menu in it. So when the game character dies it triggers a scoreboard by sending it a message. The menu shows but when i want to get input to hide it, that doesn’t work.

0 Likes

#2

hello m8 welcome to defold you want to hide the gui node example the text or you want delete? if you want hide a node you can do this

gui.set_enabled(gui.get_node("nameofnode"), false)

to hide

gui.set_enabled(gui.get_node("nameofnode"), true)

to enable a node

thanks I hope this helps

1 Like

#3

thank you very much :slightly_smiling_face:

1 Like

#4

thanks and be well, does this helped your issue if yes to put as solved

1 Like

#5

Yes it helped :blush:

1 Like

#6

ok nice to hear. be well m8 thanks and again welcome to defold I am a learner too, forum is the best place for you to ask and search things, also learn where is the manuals, and @britzl examples

0 Likes

#7

You could add the menu GUI in the same screen as the main game or you could make it a separate screen and load and unload it. This is shown as an example here: https://defold.com/examples/collection/proxy/

1 Like

#8

Thank you, i’ll go with the collection proxy :blush: if i save a variable “best score” in the main collection and reload with collection proxy, does the variable “best score” reinitialize?

0 Likes

#9

Yes it will be. You can either store the best-score in a shared Lua module, but that will not persist between application starts. You need to save the score to file. It’s actually pretty easy:

2 Likes

#10

thank you @britzl

0 Likes