...
This commit is contained in:
parent
671c8a7212
commit
80907c4067
4 changed files with 78 additions and 0 deletions
|
|
@ -0,0 +1,61 @@
|
||||||
|
```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"]
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
```python
|
||||||
|
func create_button_pink() -> void:
|
||||||
|
var button := Button.new()
|
||||||
|
row_bodies.add_child(button)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```python
|
||||||
|
func create_buttons() -> void:
|
||||||
|
for current_body: String in bodies:
|
||||||
|
var button := Button.new()
|
||||||
|
row_bodies.add_child(button)
|
||||||
|
button.text = current_body.capitalize()
|
||||||
|
button.pressed.connect(func()-> void:
|
||||||
|
body.texture = bodies[current_body]
|
||||||
|
)
|
||||||
|
```
|
||||||
Loading…
Add table
Add a link
Reference in a new issue