0 votes

Hi,

i have only one script in the root-node.

extends Panel

var quit_requested = false  # if user wants to quit the game

...

func _process(delta):

   if quit_requested == true:
      get_tree().quit()
      pass

   if Input.is_action_just_pressed("MainMenuPressed"):
      mainmenu.show_modal()
      pass

func _on_BeendenButton_pressed():   #Main Menu
   quit_requested = true
   mainmenu.hide()
   pass # replace with function body

mainmenu is a popup-node
the quit-button (BeendenButton) is in this popup
The problem here is, that quit_requested is not set to true. So it seems that I dont know how the popup can change a global variable.
Before I tried a direct get_tree().quit() instead of quit_requested = true but that didnt work, maybe the same problem.

asked Mar 29, 2018 in Engine by mr.fies (25 points)

1 Answer

0 votes

You should be using signals for this :)

https://www.youtube.com/watch?v=l0BkQxF7X3E

answered Mar 30, 2018 by ColossalGnome (22 points)

thank you that was helpful, although I didnt manage to make it run yet. The problem I encountered now is, that never mind where I click, the popup hides. I checked "exlusive" property as it is written, but I can still click everywhere and it closes.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.