When a character speaks, the text is displayed on the screen using a simple UI that can show text with a progressive animation, and animations to open and close the UI, for example a speech bubble. We can use many types of text UI, depending on the situation or the character speaking, and each type of UI can have a different avatar, usually used to show a portrait of the character speaking, but it can be any kind of extra decoration. Speech texts can have a fixed position on the screen, or can have a variable position, in that case they will be placed on top of the character speaking. This chapter describes how to configure a dialog text scene to give some style to your dialogues, and add it to the game.
When showing text, a type of speech text can be specified in esc scripting to define a style for your text. The syntax is as is:
say object text type avatar
so for example we can have:
say bamboo_god "What is the meaning of this!" angry_speech avatar_god
Each type corresponds to a different scene with the nodes that will create a background for your text. If type and avatar are not defined in the esc script, no scene will be used, or the default scene will be used if you created one. So no need to rewrite your esc scripts to add the default type to all your speeches.
Avatars are usually used to display a portrait of the character speaking on the UI, but can be used for any kind of decoration. When the dialog text is invoked, an avatar can be specified (if not, the type will be "default").
The avatars pictures are defined inside the dialog type scenes, so the avatars can change depending of the dialog type (or else just repeat them in the different dialog type scenes). Only one avatar type will be visible simultaneously to the speech text.
The structure of a speech text scene is relavitely simple, an example can be found in the file ui/dialog_default.scn. The requirements are:
So the looks like this:
And here is an example of a default scene with our mini-game:
The list of speech type scenes are configured in a containing scene, found in globals/dialog_player.scn. This list scene contain a ResourcePreloader node, meaning it preloads the resource for each of the available dialog scenes. The name of the resource will be used to identify the type of the speech.
Here is an example of the minimal container scene, the list is created in the bottom central panel, open your dialog type scene with the folder icon and give it the correct name. Remember to always add a "default" speech type, and any additional types you'd like to use.
As we said, the font of your text is defined in the RichTextLabel node named "text". To add a font to your dialogs, you first have to import your font in Godot (Import > Font in the top right menu), so it can be converted to a texture font.
Here is an example of the texture font of our mini-game:
For details, see the Godot documentation about Importing font : http://docs.godotengine.org/en/latest/tutorials/asset_pipeline/importing_fonts.html
If you have several font style (Italic, bold, and so on) and you imported them in Godot and specified them in the RichTextLabel node, you can use the BBCode markup language (originally used in message boards) inside your esc script to style you text. In this example, the "Made in China" sentence will be rendered italic:
say bamboo_god "What is the meaning of this! [i]“Made in China”?![/i]
Be wary of my wrath as I shall curse you and all your lineage!"
For details on how to add BBcode in your esc scripts see the Godot documentation: http://docs.godotengine.org/en/latest/reference/bbcode_in_richtextlabel.html
And for a list of BBCode markups, see the Wikipedia page on BBCode : https://en.wikipedia.org/wiki/BBCode
In the same way, you can also give a font and a style to your tooltips by customizing the "tooltip" Label node in the ui/hud.scn file.
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.