Game menues are implemented using normal Godot scenes and GDScript code, outside of Escoria. Menues 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 menues below the current one. When a menu is opened, the game is paused.
The current game configuration is only aware of 3 menues, 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/scene_main.gd. 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 (ie 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. Alterlatively 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).
The path to each menu scene is configured in the "Project Settings" 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:
Menus have no predefined structure or functionality, but in order to work inside the stack system, they have certain API requrements.
To add your menu to the stack, call the "menu_open" parameter on the "/root/main" node:
Similarily, 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()
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 inplement a method called "input" to receive them
if event.is_action("menu_request") && event.is_pressed() &&
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"
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:
# do whatever here
If you make a Settings menu, there is a settings structure in the node found in /root/vm with the following parameters:
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 dissapear 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.