Why i can't create a simple gui menu (SOLVED)


#1

Heres my tiny project, by the way i create it inside the examples that defold give us so probably if you use only these archives font and texture for gui wont work but that easy to solve.

infiltrado.zip (1.4 MB)

my main problem here is i just need to made a simple menu, when i hit the play button change the scene to the next and when i click the pause button in the next scene just take me back to the first scene i know is a simple taks but i have like a month doing this i cant make this thing work why?


#2

Why dont you send the whole project if you are almost doing it. I gave up trying to recreate the project due to no mentioning of paths, fonts needed etc… Not sure which Defold examples project you are talking about.

/A


#3

Have you got any input bindings set up in game.input_binding? If not, add something to MOUSE_BUTTON_1 and try running again.

Secondly, are you getting any error messages in the console?


#4

branch_infiltrado.zip (1.6 MB)

ok, you’r right here is a full working project


#5

There are a couple of problems I noticed:

  • The loading/unloading of proxies was backwards so the code was trying to load an already loaded proxy and unload one that wasn’t loaded
  • The code in on_input for getting the gui node seemed to be passing a path to a node rather than the node id itself (“menu/play” instead of just “play”)

I have attached the 3 files I modified to get it working. Hope it helps!

infiltrado_bugfixes.zip (882 Bytes)


#6

but you try to build and run it to see is working?


#7

Yes, it worked here with those small fixes.


#8

it isn’t working for me, i keep seeing the same menu play button and doesnt do anything by the way i already made the changes you send me but still nothing i am too noob or what? i just replace the code nothing else


#9

We were all noobs once!

Are there any error messages appearing in the console? That’s the first place to look for clues when things don’t work.


#10

thats the thing there 0 errors everything works “fine”


#11

What I typically do in this kind of situation is to add a bunch of print() statements to my code to see if it’s running. Add a print(“hello”) or some such to init() and on_input() in your gui script file. You should see the print from the init() function and if you have set up the input correctly you should also see repeated calls to on_input() when you move the mouse, click etc.

Once you have done this initial sanity check you need to start digging deeper: Do you actually evaluate the clicks correctly and does the appropriate code run when you click on the buttons of your menu?


#12

i did it… AT LAST!!! 2 weeks trying to this stupid proxy thing i really appreciate your help and time