From 4143db5931d690d654de77460e2ccc0ac657cbe2 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Mon, 17 Aug 2020 10:45:39 +0200 Subject: [PATCH] Add second intro dialogue --- dialogues/intro_1.json | 8 +- dialogues/intro_2.json | 26 +++ fonts/dialogue_default_font_italic.tres | 10 + .../dialogue_default_font_mono_aka_small.tres | 9 + images/herbert_intro.tres | 203 ------------------ scenes/campfire.tscn | 7 +- scenes/dialogue.tscn | 20 +- scripts/DialogueBox.gd | 7 +- scripts/scenes/IntroScript.gd | 24 ++- 9 files changed, 91 insertions(+), 223 deletions(-) create mode 100644 dialogues/intro_2.json create mode 100644 fonts/dialogue_default_font_italic.tres create mode 100644 fonts/dialogue_default_font_mono_aka_small.tres delete mode 100644 images/herbert_intro.tres diff --git a/dialogues/intro_1.json b/dialogues/intro_1.json index 9d5e7a0..641faf2 100644 --- a/dialogues/intro_1.json +++ b/dialogues/intro_1.json @@ -1,6 +1,6 @@ [ - {"name": "Ely", "text": "What a shame...", "expression": "neutral"}, - {"name": "Ely", "text": "I don't like being alone.", "expression": "neutral"}, - {"name": "Ely", "text": "I just want to go home!", "expression": "neutral"}, - {"name": "Ely", "text": "Hopefully someone will come by and rescue me...", "expression": "neutral"} + {"name": "Ely", "text": "What a shame...", "expression": "none"}, + {"name": "Ely", "text": "I don't like being alone.", "expression": "none"}, + {"name": "Ely", "text": "I just want to go home!", "expression": "none"}, + {"name": "Ely", "text": "Hopefully someone will come by and rescue me...", "expression": "none"} ] diff --git a/dialogues/intro_2.json b/dialogues/intro_2.json new file mode 100644 index 0000000..001b641 --- /dev/null +++ b/dialogues/intro_2.json @@ -0,0 +1,26 @@ +[ + {"name": "Crab", "text": "Hey you!", "expression": "none"}, + {"name": "Ely", "text": "... Huh?", "expression": "none"}, + {"name": "Crab", "text": "You ok buddy?", "expression": "none"}, + {"name": "Ely", "text": "I must be going crazy.", "expression": "none"}, + {"name": "Crab", "text": "You don't look [i]that[/i] crazy to me.", "expression": "none"}, + {"name": "Ely", "text": "You're a crab.", "expression": "none"}, + {"name": "Crab", "text": "Yes.", "expression": "none"}, + {"name": "Ely", "text": "You speak.", "expression": "none"}, + {"name": "Crab", "text": "Of course I do you muffinhead.", "expression": "none"}, + {"name": "Ely", "text": "Cuuuuute!", "expression": "blush"}, + {"name": "Ely", "text": "...", "expression": "none"}, + {"name": "Ely", "text": "So you're a cute talking crab.", "expression": "none"}, + {"name": "Crab", "text": "", "expression": "blush"}, + {"name": "Ely", "text": "Do you have a name? [code](by any chance...)[/code]", "expression": "none"}, + {"name": "Crab", "text": "The name's Herbert.", "expression": "none"}, + {"name": "Herbert", "text": "I am a [wave amp=20 freq=2]Pachygrapsus Marmoratus[/wave] as you [i]hoomans[/i] like to call us.", "expression": "none"}, + {"name": "Ely", "text": "What brings you here Herbert?", "expression": "none"}, + {"name": "Ely", "text": "Also, what made you the first crab to talk to me [i]ever[/i]?", "expression": "none"}, + {"name": "Herbert", "text": "I'll tell you my tale, but then please tell me yours.", "expression": "none"}, + {"name": "Ely", "text": "Sure!", "expression": "none"}, + {"name": "Crab", "text": "Everything was fine.", "expression": "none"}, + {"name": "Crab", "text": "I was fine, my friends were fine...", "expression": "none"}, + {"name": "Crab", "text": "Even my brother Gary was starting to overcome his depression.", "expression": "none"}, + {"name": "Crab", "text": "And then...", "expression": "none"} +] diff --git a/fonts/dialogue_default_font_italic.tres b/fonts/dialogue_default_font_italic.tres new file mode 100644 index 0000000..7375e4d --- /dev/null +++ b/fonts/dialogue_default_font_italic.tres @@ -0,0 +1,10 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[sub_resource type="DynamicFontData" id=1] +antialiased = false +font_path = "res://fonts/EnterCommand-Italic.ttf" + +[resource] +outline_color = Color( 0, 0, 0, 1 ) +extra_spacing_bottom = -6 +font_data = SubResource( 1 ) diff --git a/fonts/dialogue_default_font_mono_aka_small.tres b/fonts/dialogue_default_font_mono_aka_small.tres new file mode 100644 index 0000000..a618449 --- /dev/null +++ b/fonts/dialogue_default_font_mono_aka_small.tres @@ -0,0 +1,9 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[sub_resource type="DynamicFontData" id=1] +antialiased = false +font_path = "res://fonts/Picopixel.ttf" + +[resource] +size = 8 +font_data = SubResource( 1 ) diff --git a/images/herbert_intro.tres b/images/herbert_intro.tres deleted file mode 100644 index 4a3599e..0000000 --- a/images/herbert_intro.tres +++ /dev/null @@ -1,203 +0,0 @@ -[gd_resource type="SpriteFrames" load_steps=49 format=2] - -[ext_resource path="res://images/herbert_SecondStep.png" type="Texture" id=1] -[ext_resource path="res://images/herbert_Eyes.png" type="Texture" id=2] -[ext_resource path="res://images/herbert_FirstStep.png" type="Texture" id=3] - -[sub_resource type="AtlasTexture" id=1] -atlas = ExtResource( 2 ) -region = Rect2( 0, 0, 192, 108 ) - -[sub_resource type="AtlasTexture" id=2] -atlas = ExtResource( 2 ) -region = Rect2( 192, 0, 192, 108 ) - -[sub_resource type="AtlasTexture" id=3] -atlas = ExtResource( 2 ) -region = Rect2( 384, 0, 192, 108 ) - -[sub_resource type="AtlasTexture" id=4] -atlas = ExtResource( 2 ) -region = Rect2( 0, 108, 192, 108 ) - -[sub_resource type="AtlasTexture" id=5] -atlas = ExtResource( 2 ) -region = Rect2( 192, 108, 192, 108 ) - -[sub_resource type="AtlasTexture" id=6] -atlas = ExtResource( 2 ) -region = Rect2( 384, 108, 192, 108 ) - -[sub_resource type="AtlasTexture" id=7] -atlas = ExtResource( 2 ) -region = Rect2( 0, 216, 192, 108 ) - -[sub_resource type="AtlasTexture" id=8] -atlas = ExtResource( 2 ) -region = Rect2( 192, 216, 192, 108 ) - -[sub_resource type="AtlasTexture" id=9] -atlas = ExtResource( 2 ) -region = Rect2( 384, 216, 192, 108 ) - -[sub_resource type="AtlasTexture" id=10] -atlas = ExtResource( 2 ) -region = Rect2( 0, 324, 192, 108 ) - -[sub_resource type="AtlasTexture" id=11] -atlas = ExtResource( 2 ) -region = Rect2( 192, 324, 192, 108 ) - -[sub_resource type="AtlasTexture" id=12] -atlas = ExtResource( 1 ) -region = Rect2( 0, 0, 192, 108 ) - -[sub_resource type="AtlasTexture" id=13] -atlas = ExtResource( 1 ) -region = Rect2( 192, 0, 192, 108 ) - -[sub_resource type="AtlasTexture" id=14] -atlas = ExtResource( 1 ) -region = Rect2( 384, 0, 192, 108 ) - -[sub_resource type="AtlasTexture" id=15] -atlas = ExtResource( 1 ) -region = Rect2( 0, 108, 192, 108 ) - -[sub_resource type="AtlasTexture" id=16] -atlas = ExtResource( 1 ) -region = Rect2( 192, 108, 192, 108 ) - -[sub_resource type="AtlasTexture" id=17] -atlas = ExtResource( 1 ) -region = Rect2( 384, 108, 192, 108 ) - -[sub_resource type="AtlasTexture" id=18] -atlas = ExtResource( 1 ) -region = Rect2( 0, 216, 192, 108 ) - -[sub_resource type="AtlasTexture" id=19] -atlas = ExtResource( 1 ) -region = Rect2( 192, 216, 192, 108 ) - -[sub_resource type="AtlasTexture" id=20] -atlas = ExtResource( 1 ) -region = Rect2( 384, 216, 192, 108 ) - -[sub_resource type="AtlasTexture" id=21] -atlas = ExtResource( 1 ) -region = Rect2( 0, 324, 192, 108 ) - -[sub_resource type="AtlasTexture" id=22] -atlas = ExtResource( 1 ) -region = Rect2( 192, 324, 192, 108 ) - -[sub_resource type="AtlasTexture" id=23] -atlas = ExtResource( 1 ) -region = Rect2( 384, 324, 192, 108 ) - -[sub_resource type="AtlasTexture" id=24] -atlas = ExtResource( 1 ) -region = Rect2( 0, 432, 192, 108 ) - -[sub_resource type="AtlasTexture" id=25] -atlas = ExtResource( 1 ) -region = Rect2( 192, 432, 192, 108 ) - -[sub_resource type="AtlasTexture" id=26] -atlas = ExtResource( 3 ) -region = Rect2( 0, 0, 192, 108 ) - -[sub_resource type="AtlasTexture" id=27] -atlas = ExtResource( 3 ) -region = Rect2( 192, 0, 192, 108 ) - -[sub_resource type="AtlasTexture" id=28] -atlas = ExtResource( 3 ) -region = Rect2( 384, 0, 192, 108 ) - -[sub_resource type="AtlasTexture" id=29] -atlas = ExtResource( 3 ) -region = Rect2( 0, 108, 192, 108 ) - -[sub_resource type="AtlasTexture" id=30] -atlas = ExtResource( 3 ) -region = Rect2( 192, 108, 192, 108 ) - -[sub_resource type="AtlasTexture" id=31] -atlas = ExtResource( 3 ) -region = Rect2( 384, 108, 192, 108 ) - -[sub_resource type="AtlasTexture" id=32] -atlas = ExtResource( 3 ) -region = Rect2( 0, 216, 192, 108 ) - -[sub_resource type="AtlasTexture" id=33] -atlas = ExtResource( 3 ) -region = Rect2( 192, 216, 192, 108 ) - -[sub_resource type="AtlasTexture" id=34] -atlas = ExtResource( 3 ) -region = Rect2( 384, 216, 192, 108 ) - -[sub_resource type="AtlasTexture" id=35] -atlas = ExtResource( 3 ) -region = Rect2( 0, 324, 192, 108 ) - -[sub_resource type="AtlasTexture" id=36] -atlas = ExtResource( 3 ) -region = Rect2( 192, 324, 192, 108 ) - -[sub_resource type="AtlasTexture" id=37] -atlas = ExtResource( 3 ) -region = Rect2( 384, 324, 192, 108 ) - -[sub_resource type="AtlasTexture" id=38] -atlas = ExtResource( 3 ) -region = Rect2( 0, 432, 192, 108 ) - -[sub_resource type="AtlasTexture" id=39] -atlas = ExtResource( 3 ) -region = Rect2( 192, 432, 192, 108 ) - -[sub_resource type="AtlasTexture" id=40] -atlas = ExtResource( 3 ) -region = Rect2( 384, 432, 192, 108 ) - -[sub_resource type="AtlasTexture" id=41] -atlas = ExtResource( 3 ) -region = Rect2( 0, 540, 192, 108 ) - -[sub_resource type="AtlasTexture" id=42] -atlas = ExtResource( 3 ) -region = Rect2( 192, 540, 192, 108 ) - -[sub_resource type="AtlasTexture" id=43] -atlas = ExtResource( 3 ) -region = Rect2( 384, 540, 192, 108 ) - -[sub_resource type="AtlasTexture" id=44] -atlas = ExtResource( 3 ) -region = Rect2( 0, 648, 192, 108 ) - -[sub_resource type="AtlasTexture" id=45] -atlas = ExtResource( 3 ) -region = Rect2( 192, 648, 192, 108 ) - -[resource] -animations = [ { -"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ], -"loop": false, -"name": "eyes", -"speed": 10.0 -}, { -"frames": [ SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 25 ) ], -"loop": false, -"name": "second_step", -"speed": 10.0 -}, { -"frames": [ SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 31 ), SubResource( 32 ), SubResource( 33 ), SubResource( 34 ), SubResource( 35 ), SubResource( 36 ), SubResource( 37 ), SubResource( 38 ), SubResource( 39 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ), SubResource( 43 ), SubResource( 44 ), SubResource( 45 ) ], -"loop": false, -"name": "first_step", -"speed": 10.0 -} ] diff --git a/scenes/campfire.tscn b/scenes/campfire.tscn index 733588b..a6ac63e 100644 --- a/scenes/campfire.tscn +++ b/scenes/campfire.tscn @@ -10,13 +10,13 @@ [node name="Campfire (background)" type="AnimatedSprite" parent="."] frames = ExtResource( 1 ) -frame = 20 +frame = 21 playing = true centered = false [node name="Ely" type="AnimatedSprite" parent="."] frames = ExtResource( 2 ) -frame = 128 +frame = 33 playing = true centered = false @@ -40,4 +40,5 @@ visible = false script = ExtResource( 4 ) dialogue_box_path = NodePath("../UI/Dialog") herbert_sprite_path = NodePath("../Herbert") -intro_dialogue = "res://dialogues/intro_1.json" +intro_dialogue_1 = "res://dialogues/intro_1.json" +intro_dialogue_2 = "res://dialogues/intro_2.json" diff --git a/scenes/dialogue.tscn b/scenes/dialogue.tscn index 616477a..4fe30f2 100644 --- a/scenes/dialogue.tscn +++ b/scenes/dialogue.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=9 format=2] +[gd_scene load_steps=11 format=2] [ext_resource path="res://images/ui/dialogue_bg.png" type="Texture" id=1] [ext_resource path="res://fonts/dialog_default_font.tres" type="DynamicFont" id=2] [ext_resource path="res://scripts/DialogueBox.gd" type="Script" id=3] +[ext_resource path="res://fonts/dialogue_default_font_italic.tres" type="DynamicFont" id=4] +[ext_resource path="res://fonts/dialogue_default_font_mono_aka_small.tres" type="DynamicFont" id=5] [sub_resource type="VisualShaderNodeColorConstant" id=1] constant = Color( 0, 0, 0, 0.803922 ) @@ -99,9 +101,9 @@ __meta__ = { } [node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer"] -margin_top = 50.0 +margin_top = 47.0 margin_right = 22.0 -margin_bottom = 83.0 +margin_bottom = 80.0 size_flags_horizontal = 0 size_flags_stretch_ratio = 0.2 custom_constants/margin_right = 4 @@ -150,7 +152,7 @@ __meta__ = { [node name="MarginContainer2" type="MarginContainer" parent="MarginContainer/VBoxContainer"] show_behind_parent = true -margin_top = 83.0 +margin_top = 80.0 margin_right = 184.0 margin_bottom = 108.0 __meta__ = { @@ -161,7 +163,7 @@ __meta__ = { show_behind_parent = true material = SubResource( 5 ) margin_right = 184.0 -margin_bottom = 25.0 +margin_bottom = 28.0 texture = ExtResource( 1 ) patch_margin_left = 10 patch_margin_top = 10 @@ -173,7 +175,7 @@ __meta__ = { [node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer/MarginContainer2"] margin_right = 184.0 -margin_bottom = 25.0 +margin_bottom = 28.0 custom_constants/margin_right = 6 custom_constants/margin_top = 2 custom_constants/margin_left = 6 @@ -186,12 +188,14 @@ __meta__ = { margin_left = 6.0 margin_top = 2.0 margin_right = 178.0 -margin_bottom = 23.0 +margin_bottom = 26.0 rect_clip_content = false size_flags_horizontal = 3 +custom_fonts/mono_font = ExtResource( 5 ) +custom_fonts/italics_font = ExtResource( 4 ) custom_fonts/normal_font = ExtResource( 2 ) bbcode_enabled = true -bbcode_text = "[center]Wtf is going on, where am I and where did you hide the cheese?![/center]" +bbcode_text = "[center][wave amp=20 freq=2]Wtf is going on[/wave], [tornado radius=1.5 freq=2]where am I[/tornado] and [code]where did you hide[/code] [i]the cheese[/i]?![/center]" text = "Wtf is going on, where am I and where did you hide the cheese?!" fit_content_height = true __meta__ = { diff --git a/scripts/DialogueBox.gd b/scripts/DialogueBox.gd index db79b50..b1feffd 100644 --- a/scripts/DialogueBox.gd +++ b/scripts/DialogueBox.gd @@ -2,6 +2,7 @@ extends Control class_name DialogueBox signal end +signal update export (NodePath) var title_path onready var title = get_node(title_path) as RichTextLabel @@ -41,11 +42,13 @@ func next() -> void: _update() func _update() -> void: - title.text = _dialogue[_index].name + title.bbcode_text = _dialogue[_index].name title.rect_min_size.x = title.get_font('normal_font').get_string_size(title.text).x - text.text = _dialogue[_index].text + text.bbcode_text = _dialogue[_index].text #expression = _dialogue[_index].expression + emit_signal('update') + animate_text() func animate_text(): diff --git a/scripts/scenes/IntroScript.gd b/scripts/scenes/IntroScript.gd index bf9d7f7..afcc656 100644 --- a/scripts/scenes/IntroScript.gd +++ b/scripts/scenes/IntroScript.gd @@ -1,22 +1,36 @@ extends Node class_name IntroScript +signal end_step + export (NodePath) var dialogue_box_path onready var dialogue_box = get_node(dialogue_box_path) export (NodePath) var herbert_sprite_path onready var herbert_sprite = get_node(herbert_sprite_path) -export (String, FILE, '*.json') var intro_dialogue : String +export (String, FILE, '*.json') var intro_dialogue_1 : String +export (String, FILE, '*.json') var intro_dialogue_2 : String func _ready(): assert(dialogue_box != null) assert(herbert_sprite != null) + dialogue_box.connect('update', self, 'update_camera') + yield(get_tree().create_timer(2.0), 'timeout') - yield(start_dialogue(intro_dialogue), 'end') + yield(start_dialogue(intro_dialogue_1), 'end') yield(get_tree().create_timer(2.0), 'timeout') do_crab_step() + yield(self, 'end_step') + yield(start_dialogue(intro_dialogue_2), 'end') + +func update_camera(): + var line = dialogue_box._dialogue[dialogue_box._index] + if line.name == 'Crab' || line.name == 'Herbert': + herbert_sprite.show() + else: + herbert_sprite.hide() func start_dialogue(dialog_path : String) -> DialogueAction: var dialogue = DialogueAction.new() @@ -39,7 +53,11 @@ func do_crab_step(): elif crab_step == 2: herbert_sprite.play('second_step') elif crab_step == 3: - herbert_sprite.hide() + herbert_sprite.disconnect('animation_finished', self, 'crab_animation_finished') + herbert_sprite.play('third_step') + yield(herbert_sprite, 'animation_finished') + herbert_sprite.play('idle') + emit_signal("end_step") crab_step += 1 func crab_animation_finished():