61 lines
1.1 KiB
Markdown
61 lines
1.1 KiB
Markdown
|
|
```python
|
||
|
|
var inventory: Array[Dictionary] = [
|
||
|
|
{
|
||
|
|
"name": "sword",
|
||
|
|
"amount": 1,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "potion",
|
||
|
|
"amount": 5,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "potion",
|
||
|
|
"amount": 3,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "coins",
|
||
|
|
"amount": 65,
|
||
|
|
},
|
||
|
|
]
|
||
|
|
```
|
||
|
|
[]
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
```python
|
||
|
|
var expressions := {
|
||
|
|
"happy" : preload("res://assets/emotion_happy.png"),
|
||
|
|
"regular" : preload("res://assets/emotion_regular.png"),
|
||
|
|
"sad" : preload("res://assets/emotion_sad.png"),
|
||
|
|
}
|
||
|
|
|
||
|
|
var dialogue_items: Array[Dictionary]= [
|
||
|
|
{
|
||
|
|
"expression": expressions["regular"],
|
||
|
|
"text": "I'm learning about Arrays..."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"expression": expressions["sad"],
|
||
|
|
"text": "... and it is a little bit complicated."
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"expression": expressions["happy"],
|
||
|
|
"text": "Let's see if I got it right: an array is a list of values!",
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"expression": expressions["regular"],
|
||
|
|
"text": "Did I get it right? Did I?",
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"expression": expressions["happy"],
|
||
|
|
"text": "Hehe! Bye bye~!",
|
||
|
|
},
|
||
|
|
]
|
||
|
|
|
||
|
|
func show_text() -> void:
|
||
|
|
var current_item := dialogue_items[current_item_index]
|
||
|
|
rich_text_label.text = current_item["text"]
|
||
|
|
expression.texture = current_item["expression"]
|
||
|
|
```
|