Add a tiny part of the script to the campfire intro scene

This commit is contained in:
Alice Gaudon 2020-08-16 10:25:32 +02:00
parent 8c8f58a398
commit 6f4c375465
11 changed files with 265 additions and 38 deletions

View File

@ -1,8 +1,6 @@
[ [
{"name": "Ely", "text": "Heyo!", "expression": "neutral"}, {"name": "Ely", "text": "What a shame...", "expression": "neutral"},
{"name": "Ely", "text": "My name Ely", "expression": "neutral"}, {"name": "Ely", "text": "I don't like being alone.", "expression": "neutral"},
{"name": "Ely", "text": "I do fun stuff", "expression": "neutral"}, {"name": "Ely", "text": "I just want to go home!", "expression": "neutral"},
{"name": "Ely", "text": "It is very fun", "expression": "neutral"}, {"name": "Ely", "text": "Hopefully someone will come by and rescue me...", "expression": "neutral"}
{"name": "Crab", "text": "Also that's a very good dialogue with a very very long text", "expression": "neutral"},
{"name": "Crab", "text": "lorem ipsum dolor sit amet truc machin bidule lorem ipsum dolor sit amet truc machin bidule lorem ipsum dolor sit amet truc machin bidule", "expression": "neutral"}
] ]

View File

@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0 compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
flags/repeat=0 flags/repeat=0
flags/filter=true flags/filter=false
flags/mipmaps=false flags/mipmaps=false
flags/anisotropic=false flags/anisotropic=false
flags/srgb=2 flags/srgb=2

View File

@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0 compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
flags/repeat=0 flags/repeat=0
flags/filter=true flags/filter=false
flags/mipmaps=false flags/mipmaps=false
flags/anisotropic=false flags/anisotropic=false
flags/srgb=2 flags/srgb=2

View File

@ -20,7 +20,7 @@ compress/hdr_mode=0
compress/bptc_ldr=0 compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
flags/repeat=0 flags/repeat=0
flags/filter=true flags/filter=false
flags/mipmaps=false flags/mipmaps=false
flags/anisotropic=false flags/anisotropic=false
flags/srgb=2 flags/srgb=2

203
images/herbert_intro.tres Normal file
View File

@ -0,0 +1,203 @@
[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
} ]

View File

@ -10,16 +10,6 @@ config_version=4
_global_script_classes=[ { _global_script_classes=[ {
"base": "Node", "base": "Node",
"class": "AsepriteImportData",
"language": "GDScript",
"path": "res://addons/aseprite_importer/classes/AsepriteImportData.gd"
}, {
"base": "Node",
"class": "AsepriteImporter",
"language": "GDScript",
"path": "res://addons/aseprite_importer/classes/AsepriteImporter.gd"
}, {
"base": "Node",
"class": "DialogueAction", "class": "DialogueAction",
"language": "GDScript", "language": "GDScript",
"path": "res://scripts/DialogueAction.gd" "path": "res://scripts/DialogueAction.gd"
@ -30,21 +20,13 @@ _global_script_classes=[ {
"path": "res://scripts/DialogueBox.gd" "path": "res://scripts/DialogueBox.gd"
}, { }, {
"base": "Node", "base": "Node",
"class": "EditorTheme",
"language": "GDScript",
"path": "res://addons/aseprite_importer/classes/EditorTheme.gd"
}, {
"base": "Node",
"class": "IntroScript", "class": "IntroScript",
"language": "GDScript", "language": "GDScript",
"path": "res://scripts/scenes/IntroScript.gd" "path": "res://scripts/scenes/IntroScript.gd"
} ] } ]
_global_script_class_icons={ _global_script_class_icons={
"AsepriteImportData": "",
"AsepriteImporter": "",
"DialogueAction": "", "DialogueAction": "",
"DialogueBox": "", "DialogueBox": "",
"EditorTheme": "",
"IntroScript": "" "IntroScript": ""
} }
@ -65,7 +47,7 @@ window/stretch/aspect="keep"
[editor_plugins] [editor_plugins]
enabled=PoolStringArray( "aseprite_importer" ) enabled=PoolStringArray( )
[input] [input]

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=5 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://images/campfire.tres" type="SpriteFrames" id=1] [ext_resource path="res://images/campfire.tres" type="SpriteFrames" id=1]
[ext_resource path="res://images/ely.tres" type="SpriteFrames" id=2] [ext_resource path="res://images/ely.tres" type="SpriteFrames" id=2]
[ext_resource path="res://scenes/dialogue.tscn" type="PackedScene" id=3] [ext_resource path="res://scenes/dialogue.tscn" type="PackedScene" id=3]
[ext_resource path="res://scripts/scenes/IntroScript.gd" type="Script" id=4] [ext_resource path="res://scripts/scenes/IntroScript.gd" type="Script" id=4]
[ext_resource path="res://images/herbert_intro.tres" type="SpriteFrames" id=5]
[node name="root" type="Node2D"] [node name="root" type="Node2D"]
@ -15,7 +16,15 @@ centered = false
[node name="Ely" type="AnimatedSprite" parent="."] [node name="Ely" type="AnimatedSprite" parent="."]
frames = ExtResource( 2 ) frames = ExtResource( 2 )
frame = 49 frame = 97
playing = true
centered = false
[node name="Herbert" type="AnimatedSprite" parent="."]
visible = false
frames = ExtResource( 5 )
animation = "eyes"
frame = 10
playing = true playing = true
centered = false centered = false
@ -32,4 +41,5 @@ visible = false
[node name="IntroScript" type="Node" parent="."] [node name="IntroScript" type="Node" parent="."]
script = ExtResource( 4 ) script = ExtResource( 4 )
dialogue_box_path = NodePath("../UI/Dialog") dialogue_box_path = NodePath("../UI/Dialog")
start_dialogue = "res://dialogues/intro_1.json" herbert_sprite_path = NodePath("../Herbert")
intro_dialogue = "res://dialogues/intro_1.json"

View File

@ -24,7 +24,7 @@ script = ExtResource( 1 )
[node name="Fire" type="AnimatedSprite" parent="."] [node name="Fire" type="AnimatedSprite" parent="."]
frames = ExtResource( 6 ) frames = ExtResource( 6 )
animation = "start" animation = "start"
frame = 38 frame = 41
playing = true playing = true
centered = false centered = false
script = ExtResource( 1 ) script = ExtResource( 1 )
@ -86,5 +86,3 @@ __meta__ = {
} }
[connection signal="animation_finished" from="background" to="background" method="_on_background_animation_finished"] [connection signal="animation_finished" from="background" to="background" method="_on_background_animation_finished"]
[connection signal="animation_finished" from="Fire" to="Fire" method="_on_background_animation_finished"] [connection signal="animation_finished" from="Fire" to="Fire" method="_on_background_animation_finished"]
[connection signal="pressed" from="UI/Buttons/PlayButton" to="UI/Buttons/PlayButton" method="_on_Button_pressed"]
[connection signal="pressed" from="UI/Buttons/QuitButton" to="UI/Buttons/QuitButton" method="_on_Button_pressed"]

View File

@ -1,6 +1,8 @@
extends Node extends Node
class_name DialogueAction class_name DialogueAction
signal end
export (NodePath) var dialogue_box_path export (NodePath) var dialogue_box_path
onready var dialogue_box = get_node(dialogue_box_path) onready var dialogue_box = get_node(dialogue_box_path)

View File

@ -41,5 +41,3 @@ func _update() -> void:
text.text = _dialogue[_index].text text.text = _dialogue[_index].text
title.text = _dialogue[_index].name title.text = _dialogue[_index].name
#expression = _dialogue[_index].expression #expression = _dialogue[_index].expression
if _index == _dialogue.size() - 1:
emit_signal('end')

View File

@ -4,12 +4,48 @@ class_name IntroScript
export (NodePath) var dialogue_box_path export (NodePath) var dialogue_box_path
onready var dialogue_box = get_node(dialogue_box_path) onready var dialogue_box = get_node(dialogue_box_path)
export (String, FILE, '*.json') var start_dialogue : String export (NodePath) var herbert_sprite_path
onready var herbert_sprite = get_node(herbert_sprite_path)
export (String, FILE, '*.json') var intro_dialogue : String
func _ready(): func _ready():
assert(dialogue_box != null) assert(dialogue_box != null)
assert(herbert_sprite != null)
yield(get_tree().create_timer(2.0), 'timeout')
yield(start_dialogue(intro_dialogue), 'end')
yield(get_tree().create_timer(2.0), 'timeout')
do_crab_step()
func start_dialogue(dialog_path : String) -> DialogueAction:
var dialogue = DialogueAction.new() var dialogue = DialogueAction.new()
dialogue.dialogue_file_path = start_dialogue dialogue.dialogue_file_path = dialog_path
dialogue.dialogue_box = dialogue_box dialogue.dialogue_box = dialogue_box
dialogue.start() dialogue.start()
return dialogue
var crab_finished = false
var crab_step = 0
func do_crab_step():
crab_finished = false
herbert_sprite.frame = 0
if crab_step == 0:
herbert_sprite.connect('animation_finished', self, 'crab_animation_finished')
herbert_sprite.play('eyes')
herbert_sprite.show()
elif crab_step == 1:
herbert_sprite.play('first_step')
elif crab_step == 2:
herbert_sprite.play('second_step')
elif crab_step == 3:
herbert_sprite.hide()
crab_step += 1
func crab_animation_finished():
crab_finished = true
func _input(event):
if crab_finished && event.is_action_pressed('ui_accept'):
do_crab_step()