Added dialogue system start point

This commit is contained in:
Paul Norberger
2020-04-19 16:06:50 +02:00
parent 7b4bc33f91
commit 8ef83633fc
11 changed files with 255 additions and 5 deletions

View File

@@ -4,7 +4,7 @@
[ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=2]
[ext_resource path="res://Overlap/Stats/Stats.tscn" type="PackedScene" id=3]
[ext_resource path="res://Boss/SlimeBoss/SlimeBoss.gd" type="Script" id=4]
[ext_resource path="res://Boss/SlimeBoss/Animations/move_down_angry.png" type="Texture" id=5]
[ext_resource path="res://Boss/SlimeBoss/Animations/move_down.png" type="Texture" id=5]
[ext_resource path="res://Boss/SlimeBoss/States/Motion/Idle.gd" type="Script" id=7]
[ext_resource path="res://Boss/SlimeBoss/States/Motion/Stagger.gd" type="Script" id=8]
[ext_resource path="res://Boss/SlimeBoss/States/Motion/Wander.gd" type="Script" id=9]
@@ -45,11 +45,9 @@ script = ExtResource( 4 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 0.13451, -20.1418 )
scale = Vector2( 2, 2 )
texture = ExtResource( 5 )
vframes = 10
hframes = 24
frame = 65
[node name="Hitbox" parent="." instance=ExtResource( 2 )]
collision_layer = 0
@@ -98,6 +96,7 @@ script = ExtResource( 10 )
script = ExtResource( 8 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "MoveDown"
anims/MoveDown = SubResource( 4 )
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]
[connection signal="area_exited" from="Hurtbox" to="." method="_on_Hurtbox_area_exited"]

View File

@@ -0,0 +1,40 @@
extends Control
class_name DialougeBox
export(int, 0, 100) var dialogue_identifier := 0 setget set_dialogue_identifier
signal started
signal finished
var _dialogue_pos = 0
onready var dialogues := $Dialogues
var _dialogue = []
onready var label = $"CenterContainer/Label"
onready var animation_player = $AnimationPlayer
func _ready():
set_dialogue_identifier(dialogue_identifier)
update_text()
func _physics_process(delta):
if Input.is_action_just_pressed("skip"):
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")
func update_text():
print(_dialogue)
label.text = _dialogue[_dialogue_pos]
animation_player.play("next_line")
yield(animation_player, "animation_finished")
func next():
_dialogue_pos += 1_
update_text()

View File

@@ -0,0 +1,95 @@
[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/Harmonic24.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]
[sub_resource type="Animation" id=1]
resource_name = "begin_dialouge"
length = 0.5
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("CenterContainer:margin_top")
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,
"values": [ 0.0, 1.0 ]
}
[sub_resource type="Animation" id=2]
resource_name = "next_line"
length = 3.0
tracks/0/type = "value"
tracks/0/path = NodePath("CenterContainer/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, 3 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ 0.0, 1.0 ]
}
[node name="DialogueBox" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/begin_dialouge = SubResource( 1 )
anims/next_line = SubResource( 2 )
[node name="Dialogues" type="Node" parent="."]
script = ExtResource( 4 )
[node name="CenterContainer" type="CenterContainer" parent="."]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -240.0
margin_right = 240.0
margin_bottom = 31.0
__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 = 157.0
margin_top = 3.0
margin_right = 322.0
margin_bottom = 27.0
custom_fonts/font = ExtResource( 2 )
text = "Hahaha, Schmock."
align = 1
percent_visible = 0.0
__meta__ = {
"_edit_use_anchors_": false
}

View File

@@ -0,0 +1,27 @@
extends Node
var _dialogues = []
func _ready():
_dialogues.append([
"Hero;I... I... I need to go pee",
"Boss;After this you won't need to pee ever again!",
"More text...............",
"Even more text................",
".................................",
".........................",
"...................",
"...",
"We're done here."
])
_dialogues.append([
"Hero;I've come to slay you, you beast!",
"Boss;Well then... step forward!"
])
_dialogues.append([
"Hero;You've killed so many, but you won't kill me!",
"Boss;We'll see about that!"
])
func get_dialogue(id):
return _dialogues[id]

View File

@@ -0,0 +1,2 @@
Hero;I... I... I need to go pee.
Boss;You will never need to pee again!

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/box.png-7dd5d0d3b8d648002389d8b1f9ebe137.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Menus/DialogueBox/box.png"
dest_files=[ "res://.import/box.png-7dd5d0d3b8d648002389d8b1f9ebe137.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@@ -22,4 +22,4 @@ Item = ExtResource( 3 )
[node name="DragSink" parent="." instance=ExtResource( 2 )]
margin_left = 1.19746
margin_right = 1.19745
margin_right = 1.19745

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=19 format=2]
[gd_scene load_steps=20 format=2]
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://World.gd" type="Script" id=2]
@@ -18,6 +18,7 @@
[ext_resource path="res://Objects/Slime/Slime.tscn" type="PackedScene" id=16]
[ext_resource path="res://Boss/Boss_template.tscn" type="PackedScene" id=17]
[ext_resource path="res://Boss/SlimeBoss/SlimeBoss.tscn" type="PackedScene" id=18]
[ext_resource path="res://Menus/DialogueBox/DialogueBox.tscn" type="PackedScene" id=19]
[node name="World" type="Node2D"]
script = ExtResource( 2 )
@@ -125,6 +126,18 @@ FRICTION = 200
[node name="Bonfire" parent="." instance=ExtResource( 7 )]
position = Vector2( 448, 104 )
[node name="CenterContainer" type="CenterContainer" parent="."]
margin_right = 40.0
margin_bottom = 40.0
use_top_left = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="DialogueBox" parent="CenterContainer" instance=ExtResource( 19 )]
anchor_right = 0.0
anchor_bottom = 0.0
[editable path="YSort/minion"]
[editable path="YSort/minion/Hurtbox"]

34
src/palette.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/palette.png-d856c922a66047950b8cb0cc7a9eeeb7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://palette.png"
dest_files=[ "res://.import/palette.png-d856c922a66047950b8cb0cc7a9eeeb7.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@@ -14,6 +14,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://Boss/Boss_template.gd"
}, {
"base": "Control",
"class": "DialougeBox",
"language": "GDScript",
"path": "res://Menus/DialogueBox/DialogueBox.gd"
}, {
"base": "KinematicBody2D",
"class": "Player",
"language": "GDScript",
@@ -36,6 +41,7 @@ _global_script_classes=[ {
} ]
_global_script_class_icons={
"Boss": "",
"DialougeBox": "",
"Player": "",
"SlimeBoss": "",
"TitleSceenButton": "",