mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-13 14:02:23 +02:00
Now working Textbox
This commit is contained in:
@@ -5,36 +5,40 @@ export(int, 0, 100) var dialogue_identifier := 0 setget set_dialogue_identifier
|
||||
signal started
|
||||
signal finished
|
||||
|
||||
var _dialogue_pos = 0
|
||||
var _dialogue_pos = -1
|
||||
onready var dialogues := $Dialogues
|
||||
var _dialogue = []
|
||||
|
||||
onready var label = $"CenterContainer/Label"
|
||||
onready var label = $Label
|
||||
onready var animation_player = $AnimationPlayer
|
||||
|
||||
func _ready():
|
||||
set_dialogue_identifier(dialogue_identifier)
|
||||
update_text()
|
||||
var first_action = true
|
||||
|
||||
func _physics_process(delta):
|
||||
if Input.is_action_just_pressed("skip"):
|
||||
if(first_action):
|
||||
set_dialogue_identifier(dialogue_identifier)
|
||||
update_text()
|
||||
first_action != first_action
|
||||
next()
|
||||
|
||||
func set_dialogue_identifier(val):
|
||||
dialogue_identifier = val
|
||||
_dialogue = dialogues.get_dialogue(val)
|
||||
|
||||
_dialogue_pos = 0
|
||||
animation_player.play("begin_dialouge")
|
||||
yield(animation_player, "animation_finished")
|
||||
_dialogue_pos = 0
|
||||
|
||||
|
||||
func update_text():
|
||||
print(_dialogue)
|
||||
print(_dialogue[_dialogue_pos])
|
||||
label.text = _dialogue[_dialogue_pos]
|
||||
animation_player.play("next_line")
|
||||
yield(animation_player, "animation_finished")
|
||||
|
||||
|
||||
func next():
|
||||
_dialogue_pos += 1_
|
||||
_dialogue_pos += 1
|
||||
if(_dialogue_pos>=_dialogue.size()):
|
||||
_dialogue_pos = 0
|
||||
update_text()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://Menus/DialogueBox/box.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Fonts/Harmonic/Harmonic12.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://Menus/DialogueBox/DialogueBox.gd" type="Script" id=3]
|
||||
[ext_resource path="res://Menus/DialogueBox/Dialogues.gd" type="Script" id=4]
|
||||
|
||||
@@ -9,24 +10,12 @@ resource_name = "begin_dialouge"
|
||||
length = 0.5
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("CenterContainer:margin_top")
|
||||
tracks/0/path = NodePath("Label:percent_visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.2 ),
|
||||
"transitions": PoolRealArray( 1, 0.8 ),
|
||||
"update": 0,
|
||||
"values": [ 280, 235 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("CenterContainer/Label:percent_visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
@@ -37,7 +26,7 @@ tracks/1/keys = {
|
||||
resource_name = "next_line"
|
||||
length = 3.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("CenterContainer/Label:percent_visible")
|
||||
tracks/0/path = NodePath("Label:percent_visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
@@ -49,7 +38,7 @@ tracks/0/keys = {
|
||||
"values": [ 0.0, 1.0 ]
|
||||
}
|
||||
|
||||
[node name="DialogueBox" type="Control"]
|
||||
[node name="DialogueBox" type="CenterContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 3 )
|
||||
@@ -64,23 +53,25 @@ anims/next_line = SubResource( 2 )
|
||||
[node name="Dialogues" type="Node" parent="."]
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
margin_right = 480.0
|
||||
margin_bottom = 31.0
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
margin_left = 24.0
|
||||
margin_top = 119.0
|
||||
margin_right = 456.0
|
||||
margin_bottom = 150.0
|
||||
texture = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="CenterContainer"]
|
||||
margin_left = 24.0
|
||||
margin_right = 456.0
|
||||
margin_bottom = 31.0
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="Label" type="Label" parent="CenterContainer"]
|
||||
margin_left = 208.0
|
||||
margin_top = 8.0
|
||||
margin_right = 271.0
|
||||
margin_bottom = 22.0
|
||||
text = "Haha. Lol."
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_left = 187.0
|
||||
margin_top = 129.0
|
||||
margin_right = 292.0
|
||||
margin_bottom = 141.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "Hahaha. I hate Humans."
|
||||
align = 1
|
||||
percent_visible = 0.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user