In order to tell some stories inside of my 21 life values game, I needed a simple way to create a comic dialogue. My solution is simple, but it serves my purpose.
I am contributing my code to the community of creators for free! You may use it as you like (MIT license). Download it on GitHub.
How to play a comic dialogue in your Godot project?
Godot looks for a textfile with such content:
[“background-image”, “character1-image”, “character2-image”, “12”, “text1”, “text2”],
The smaller speech bubbles are scaled automatically according to the amount of text.
The big bubble (for a longer text) stays in the same size.
You can exchange or add any graphics in the IMAGES folder:
The standard bubble is bubble-0.png. It is made for character 1 (left side), and the script automatically flips it for character 2 (right side).
If you want one of the characters to speak a lot of words, the “big” bubble is called bubble-b.png. In the text file that controls the comic, write “%b” before you begin your text. Example: “%bThis is my long text”
In this way, you could also create many more bubbles: Just call them bubble-1.png or bubble-x.png (use one character after the hyphen). In your text file you can then tell the script to use them in the same way: “%1This is bubble 1” or “%xThis is bubble x”.
In the text file, there is one section with a two digit number. This is what it does: