Yarn
Create Images
Hero sprite > give it platform character behaviors
enemy sprite
floor sprite (tile sprite) > give it platform behaviors
Background for Dialogue
600 x 120 px
dialogue_background.png
Name Tag 1
64x34
hero_tag.png
Name Tag 1
64x34
enemy_tag.png
Arrow
35x16
dialogue_options_arrow.png
Create Global Variables
Game Settings > Properties> Global Variables
Add new objects
In scene tab > Add new Object > Text
Create a second text box
Add new Object > Text
Create a dialogueBackground Sprite
name it
dialogueBackground
Add Animation
Add Sprite
Create a dialogueOptionsPointer Sprite
name it
dialogueBackground
Add Animation
Add Sprite
Create a nameTag Sprite
name it
nameTag
Add Animation
Add Sprite
For Animation #0 leave it blank
Add Animation
Name animation #1 hero
click add sprite and select the hero_tag image
Add Animation
Name animation #2 enemy
click add sprite and select the enemy_tag image
Apply
Create a new layer called Dialogue
Make a floor and add your hero and enemy
Add your dialogueBackground and set it to your dialogue layer then set the Z order to 1
The box will be at the bottom (Z order 1) and the text will be on top (Z order2)
Drag the dialogue object on to the play area
**Don't put it on the dialogueBackground yet because it is set to the base layer**
Set the Z order to 2
Move it to the Dialogue Layer
Set the dialogue object in the top left corner on top of the dialogueBackground and pull the right middle to the edge of the box
Drag the dialogueOptions object on to the play area
**Don't put it on the dialogueBackground yet because it is set to the base layer**
Set the Z order to 2
Move it to the Dialogue Layer
Set the dialogueOptions object below the Dialogue Object and to the right
Drag the dialogueOptionsPointer object on to the play area
**Don't put it on the dialogueBackground yet because it is set to the base layer**
Set the Z order to 2
Move it to the Dialogue Layer
Set the dialogueOptionsPointer object to the left if the word text in your dialogueOptions object
Drag the nameTag object on to the play area
**Don't put it on the dialogueBackground yet because it is set to the base layer**
Set the Z order to 2
Move it to the Dialogue Layer
Set the nameTag object object to the t opif the word text in your dialogueOptions object
Open the Events Tab
At the beginning of the scene
Hide the dialogue, dialogue, dialogueOptions, dialogueOptionsPointer, and dialogueBackground
Add action Load dialogue Tree from json file
Click Create with Yarn
Yarn will open
Click file
Select Save as Json
Save file in your GDevelop Project
This PC>Documents>Gdevelop projects >whatever file your project is in
Save file as dialogue.json
This is called a node
Double click on the node to open and edit
Change the same of Start to First because it is going to be the first conversation
In the first line, add << nameTag hero>>
This will create the command nameTag in Yarn and hero is the name of the animation
In line 2, type Hello.
In line 3, type Hey.
in line 4, Type What's Good?
Go to line 5 and click the link button
This will add your first options to answer
Add
Not good homie between the green brackets
Remove the gray/black |]] from the end of line 6
Add bad after the blue|
bad is going to be the name of the node in your dialogue tree
In line 7, add
[[ Life is good |good ]]
This will connect to the node called good
Click off the node and you will now wee that two additional nodes have been created
Organize your nodes how you wish then click on the node called good
You will be continuing the conversation here
Keep the same nameTag and respond as hero
Do the same with the bad node
Click off your node the right click in the workspace to create a new node
Open up your new node and name it second
This is going to be the next conversation you have if you interact with the sprite a second time
Once you are done, click apply > OK
Add a new event
Condition
Dialogue is Running
Action
Show dialogue
Show dialogueBackground
Activate behavior PlatformerObject of hero : No (We don't want the character to be moving around when they are talking)
Create a new event
condition
Dialogue is running (We want to invert this condition so that it's when dialogue is NOT running)
Key in Pressed X
Value of a scene timer (This adds a half second of time once the dialogue has finished so you have time to read it.
**Make sure you arrange the conditions in the following order**
Key Pressed
Inverted Dialogue
Timer
Action
Hide dialogie
hide dialogue background
activate hero behavior
Animation by name
Object nameTag
Animation name None