Creating Point and Click Games with Escoria

Game menus

Game menus are implemented using normal Godot scenes and GDScript code, outside of Escoria. Menus are placed on a specific canvas layer on top of the main scene, and they act as a top stack. The menu at the top of the stack receives all the input from the _input callback, but you need to make sure to block the UI so that mouse clicks and such can't go to the menus below the current one. When a menu is opened, the game is paused.

The current game configuration is only aware of 3 menus, the "Main Menu", the "In Game Menu" and the "Credits" menu.

The Main Menu is opened at the start of the game, from the script globals/ It's also opened during the main game, when the user presses the Escape key (or any other key bound to the "menu_request" input action), when the game is outside of a cutscene (i.e. when no Esc script running).

The In Game Menu is opened when the user requests the menu while a cutscene is running during the game. Keep in mind that while cutscenes are running, you can't save the game, so your in-game menu works as a pause menu, but it can't provide the full functionality of a main menu. Alternatively you could simply not open any menu while a cutscene is in progress.

The Credits Menu is opened after issuing a "game_over" command from your Esc scripts (if the parameter for credits is supplied).

Configuring your menu scenes

The path to each menu scene is configured in the Project Settings > Ui of your game, also found in the file "engine.cfg", in the "ui" section:


It's a good idea to provide paths for other menus of your game here, because they can be customized for specific platforms. From gdscript, use Globals to access the configuration values:


The Menu Lifecycle

Menus have no predefined structure or functionality, but in order to work inside the stack system, they have certain API requirements.

Adding and removing from the stack

To add your menu to the stack, call the "menu_open" parameter on the "/root/main" node:


Similarly, to remove your menu, call menu_close:


Your node is in charge of deleting itself and removing itself from the tree, etc. Generally this is done by calling queue_free().

Input and other events

The Buttons and other Controls on your menu will receive input from the mouse normally, but other types or input (like joystick events) are sent via the main scene. You menu needs to implement a method called "input" to receive them:

func input(event):
	if event.is_action("menu_request") && event.is_pressed() && !event.is_echo():

Your menu is in charge of handling the "menu_request" event, usually bound to the Escape key, to close the current menu.

Some events might cause the entire menu stack to close, so the user can go back to the game. This usually happens when a new game is started. When this happens, your menu will receive a call to the method "menu_collapsed":

func menu_collapsed():

Changing the language

When the language of the game is changed, you can get a notification on your menu to handle it. Remember your menu is on a stack, so the language could be changed by some menu on top of yours. To get the notification, add your menu to the "ui" group, and implement a "language_changed" method:

func _ready():
func language_changed():
	# do whatever here

Implementing settings

If you make a Settings menu, there is a settings structure in the node found in /root/vm with the following parameters:

varsettings_default = {
	"text_lang":    "en",
	"voice_lang":   "en",
	"music_volume": 1,
	"sfx_volume":   1,
	"voice_volume": 1,
	"fullscreen":   false,
	"skip_dialog":  true,

You can change these values directly on the node, but some will need an extra call to apply the settings. When changing the text language, also change the current locale in the TranslationServer singleton, and notify the "ui" group that the language has changed:

get_tree().call_group(0, "ui", "language_changed")

When changing the sound effects volume, also change it in the AudioServer singleton:


When changing the music volume, also notify the vm node:

vm.settings.music_volume = vol

The "skip_dialog" flags is used to toggle the skip dialog functionality. When true, while showing a speech text, the text will disappear when the speech sound file is done playing (if any). If false, it will wait for the user to click the screen to continue.

When changing the fullscreen mode, also notify the vm node:

vm.settings.fullscreen = p_fs

When you're finished changing the settings, use the "save_settings" method to save them to disk:


Il y a une erreur de communication avec le serveur Booktype. Nous ne savons pas actuellement où est le problème.

Vous devriez rafraîchir la page.