more dialogue system stuff
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"dialogTitle": "Debug Character",
|
"dialogTitle": "Brain damaged Debug Character",
|
||||||
"dialogType": "villager",
|
"dialogType": "villager",
|
||||||
"playerbeginoptions": {
|
"playerbeginoptions": {
|
||||||
"talk": [
|
"talk": [
|
||||||
@@ -57,14 +57,15 @@
|
|||||||
],
|
],
|
||||||
"No thats enough": false
|
"No thats enough": false
|
||||||
},
|
},
|
||||||
"orem ipsumorem ipsumorem ipsumorem ipsumorem ipsumorem ipsumorem ipsumorem ipsum."
|
"after yes tell me more debug text"
|
||||||
],
|
],
|
||||||
"Make it short": [
|
"Make it short": [
|
||||||
"okay so this is the short version: xyxyxyxy is xyxyxxyxxyyx123!"
|
"okay so this is the short version: xyxyxyxy is xyxyxxyxxyyx123!"
|
||||||
],
|
],
|
||||||
"No I'm good": false
|
"No I'm good": false
|
||||||
},
|
},
|
||||||
"This is the text after the prompt"
|
"This is the text after the prompt",
|
||||||
|
"and another text after the prompt"
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://hyhe4kitrbt6"]
|
[gd_scene load_steps=2 format=3]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/scene-scripts/dialog_trigger_area.cs" id="1_ujbo8"]
|
[ext_resource type="Script" path="res://src/scene-scripts/dialogue-system/dialog_trigger_area.cs" id="1_ujbo8"]
|
||||||
|
|
||||||
[node name="dialog_trigger_area" type="Area2D"]
|
[node name="dialog_trigger_area" type="Area2D"]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
|
@@ -1,54 +1,97 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://cnmlidl1blxam"]
|
[gd_scene load_steps=4 format=3 uid="uid://cg86tsupfq53i"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/scene-scripts/gui/dialog_bubble.cs" id="1_txwv4"]
|
[ext_resource type="Script" path="res://src/scene-scripts/dialog_bubble.cs" id="1_210k6"]
|
||||||
[ext_resource type="FontFile" uid="uid://cx6bvqk0ghmjv" path="res://assets/fonts/urbane-rounded-medium.otf" id="2_qrihj"]
|
[ext_resource type="FontFile" uid="uid://cx6bvqk0ghmjv" path="res://assets/fonts/urbane-rounded-medium.otf" id="2_qrihj"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5w2xu"]
|
||||||
|
|
||||||
[node name="dialog_bubble" type="CanvasLayer"]
|
[node name="dialog_bubble" type="CanvasLayer"]
|
||||||
script = ExtResource("1_txwv4")
|
script = ExtResource("1_210k6")
|
||||||
metadata/_edit_use_anchors_ = true
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="."]
|
[node name="color_rect" type="ColorRect" parent="."]
|
||||||
anchors_preset = -1
|
anchors_preset = -1
|
||||||
anchor_left = 0.163
|
anchor_left = 0.083
|
||||||
anchor_top = 0.78
|
anchor_top = 0.694
|
||||||
anchor_right = 0.863
|
anchor_right = 0.923
|
||||||
anchor_bottom = 0.977
|
anchor_bottom = 0.968
|
||||||
offset_left = -0.531006
|
offset_left = 0.428993
|
||||||
offset_top = 0.0799561
|
offset_top = 0.383972
|
||||||
offset_right = 0.56897
|
offset_right = -40.651
|
||||||
offset_bottom = -0.128052
|
offset_bottom = 19.6479
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
|
||||||
[node name="text_label" type="Label" parent="."]
|
[node name="text_label" type="RichTextLabel" parent="color_rect"]
|
||||||
|
layout_mode = 1
|
||||||
anchors_preset = -1
|
anchors_preset = -1
|
||||||
anchor_left = 0.218
|
anchor_left = 0.034
|
||||||
anchor_top = 0.812
|
anchor_top = 0.276
|
||||||
anchor_right = 0.837
|
anchor_right = 0.964
|
||||||
anchor_bottom = 0.972
|
anchor_bottom = 0.914
|
||||||
offset_left = -15.066
|
offset_left = 0.569996
|
||||||
offset_top = 8.43201
|
offset_top = 0.0679932
|
||||||
offset_right = -16.469
|
offset_right = 0.219971
|
||||||
offset_bottom = -9.80798
|
offset_bottom = 0.10199
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 0
|
grow_vertical = 0
|
||||||
|
theme_override_colors/default_color = Color(0, 0, 0, 1)
|
||||||
|
theme_override_fonts/normal_font = ExtResource("2_qrihj")
|
||||||
|
theme_override_font_sizes/normal_font_size = 32
|
||||||
|
theme_override_font_sizes/bold_font_size = 80
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "this is test text or [center][b][wave amp=50 freq=15][rainbow]This is test text[/rainbow][/wave][/b][/center]"
|
||||||
|
scroll_active = false
|
||||||
|
|
||||||
|
[node name="name_label" type="Label" parent="color_rect"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_left = 0.01
|
||||||
|
anchor_top = 0.039
|
||||||
|
anchor_right = 0.118
|
||||||
|
anchor_bottom = 0.233
|
||||||
|
offset_left = 0.0499992
|
||||||
|
offset_top = -0.0229998
|
||||||
|
offset_right = 0.389984
|
||||||
|
offset_bottom = 0.118996
|
||||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||||
theme_override_fonts/font = ExtResource("2_qrihj")
|
theme_override_fonts/font = ExtResource("2_qrihj")
|
||||||
theme_override_font_sizes/font_size = 32
|
theme_override_font_sizes/font_size = 32
|
||||||
text = "This is test text"
|
text = "???"
|
||||||
autowrap_mode = 3
|
|
||||||
|
|
||||||
[node name="name_label" type="Label" parent="."]
|
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||||
anchors_preset = -1
|
anchors_preset = 3
|
||||||
anchor_left = 0.164
|
anchor_left = 1.0
|
||||||
anchor_top = 0.782
|
anchor_top = 1.0
|
||||||
anchor_right = 0.197
|
anchor_right = 1.0
|
||||||
anchor_bottom = 0.808
|
anchor_bottom = 1.0
|
||||||
offset_left = 7.93199
|
offset_left = -466.0
|
||||||
offset_top = 4.35199
|
offset_top = -312.0
|
||||||
offset_right = 7.27698
|
offset_right = -144.0
|
||||||
offset_bottom = 4.888
|
offset_bottom = -239.0
|
||||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
size_flags_horizontal = 8
|
||||||
|
size_flags_vertical = 8
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxEmpty_5w2xu")
|
||||||
|
|
||||||
|
[node name="NinePatchRect" type="NinePatchRect" parent="PanelContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/margin_left = 15
|
||||||
|
theme_override_constants/margin_top = 15
|
||||||
|
theme_override_constants/margin_right = 15
|
||||||
|
theme_override_constants/margin_bottom = 15
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="PanelContainer/MarginContainer/VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(128, 32)
|
||||||
|
layout_mode = 2
|
||||||
theme_override_fonts/font = ExtResource("2_qrihj")
|
theme_override_fonts/font = ExtResource("2_qrihj")
|
||||||
theme_override_font_sizes/font_size = 16
|
theme_override_font_sizes/font_size = 28
|
||||||
text = "Name"
|
text = "i want to hear more"
|
||||||
|
alignment = 0
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" path="res://src/scene-scripts/player.cs" id="1_qehox"]
|
[ext_resource type="Script" path="res://src/scene-scripts/player.cs" id="1_qehox"]
|
||||||
[ext_resource type="Texture2D" uid="uid://olceowuycu8c" path="res://assets/textures/debug/dummy-player-atlas.png" id="2_yu1q5"]
|
[ext_resource type="Texture2D" uid="uid://olceowuycu8c" path="res://assets/textures/debug/dummy-player-atlas.png" id="2_yu1q5"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cnmlidl1blxam" path="res://scenes/gui/dialog_bubble.tscn" id="3_8f573"]
|
[ext_resource type="PackedScene" uid="uid://cg86tsupfq53i" path="res://scenes/gui/dialog_bubble.tscn" id="3_8f573"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tokqm"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_tokqm"]
|
||||||
atlas = ExtResource("2_yu1q5")
|
atlas = ExtResource("2_yu1q5")
|
||||||
@@ -132,4 +132,3 @@ editor_draw_drag_margin = true
|
|||||||
current = true
|
current = true
|
||||||
|
|
||||||
[node name="dialog_bubble" parent="." instance=ExtResource("3_8f573")]
|
[node name="dialog_bubble" parent="." instance=ExtResource("3_8f573")]
|
||||||
visible = false
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://dckxciecwjfgf"]
|
[gd_scene load_steps=5 format=3 uid="uid://dckxciecwjfgf"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://p5ubildre2tg" path="res://assets/textures/debug/cupcake.png" id="1_imilm"]
|
[ext_resource type="Texture2D" uid="uid://p5ubildre2tg" path="res://assets/textures/debug/cupcake.png" id="1_imilm"]
|
||||||
[ext_resource type="PackedScene" uid="uid://hyhe4kitrbt6" path="res://scenes/dialog_trigger_area.tscn" id="2_blpmd"]
|
[ext_resource type="PackedScene" path="res://scenes/dialog_trigger_area.tscn" id="2_blpmd"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pchpi"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pchpi"]
|
||||||
size = Vector2(64, 17.25)
|
size = Vector2(64, 17.25)
|
||||||
|
@@ -18,7 +18,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
public void GetDialog(string dialogFile)
|
public void GetDialog(string dialogFile)
|
||||||
{
|
{
|
||||||
parsedDialog = Json.ParseString(FileAccess.Open(dialogFile, FileAccess.ModeFlags.Read).GetAsText());
|
parsedDialog = Json.ParseString(FileAccess.Open(dialogFile, FileAccess.ModeFlags.Read).GetAsText());
|
||||||
GetNode<Label>("name_label").Text = parsedDialog.AsGodotDictionary()["dialogTitle"].AsString();
|
GetNode<Label>("color_rect/name_label").Text = parsedDialog.AsGodotDictionary()["dialogTitle"].AsString();
|
||||||
Array<string> dialogLinestest = new Array<string>();
|
Array<string> dialogLinestest = new Array<string>();
|
||||||
dialogLinestest.Add("test");
|
dialogLinestest.Add("test");
|
||||||
dialogLinestest.Add("test2");
|
dialogLinestest.Add("test2");
|
@@ -5,7 +5,7 @@ public partial class player : CharacterBody2D
|
|||||||
{
|
{
|
||||||
|
|
||||||
[Export] public string playerName;
|
[Export] public string playerName;
|
||||||
[Export] public int speed = 200;
|
[Export] public int speed = 200;
|
||||||
public bool allowMovement = true;
|
public bool allowMovement = true;
|
||||||
public Vector2 movement;
|
public Vector2 movement;
|
||||||
public AnimatedSprite2D animatedSprite;
|
public AnimatedSprite2D animatedSprite;
|
||||||
@@ -19,10 +19,10 @@ public partial class player : CharacterBody2D
|
|||||||
dialogRayCast = GetNode<RayCast2D>("rotation_center/ray_cast_2d");
|
dialogRayCast = GetNode<RayCast2D>("rotation_center/ray_cast_2d");
|
||||||
}
|
}
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
if(allowMovement) movement = Input.GetVector("move_left", "move_right", "move_up", "move_down");
|
if (allowMovement) movement = Input.GetVector("move_left", "move_right", "move_up", "move_down");
|
||||||
else movement = Vector2.Zero;
|
else movement = Vector2.Zero;
|
||||||
if(movement.Length() != 0) rotCenter.Rotation = new Vector2((float)Math.Round(movement.X,0),(float)Math.Round(movement.Y,0)).Angle();
|
if (movement.Length() != 0) rotCenter.Rotation = new Vector2((float)Math.Round(movement.X, 0), (float)Math.Round(movement.Y, 0)).Angle();
|
||||||
MoveAndCollide(movement * speed * (float)delta);
|
MoveAndCollide(movement * speed * (float)delta);
|
||||||
}
|
}
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
@@ -31,7 +31,7 @@ public partial class player : CharacterBody2D
|
|||||||
GetNode<dialog_bubble>("dialog_bubble").GetDialog(dialogRayCast.GetCollider().Get("dialogFile").AsString());
|
GetNode<dialog_bubble>("dialog_bubble").GetDialog(dialogRayCast.GetCollider().Get("dialogFile").AsString());
|
||||||
|
|
||||||
//animation system (with controller support wich cant get normalized vector)
|
//animation system (with controller support wich cant get normalized vector)
|
||||||
if(allowMovement == false)
|
if (allowMovement == false)
|
||||||
{
|
{
|
||||||
animatedSprite.Stop();
|
animatedSprite.Stop();
|
||||||
animatedSprite.Frame = 0;
|
animatedSprite.Frame = 0;
|
||||||
@@ -47,14 +47,14 @@ public partial class player : CharacterBody2D
|
|||||||
{
|
{
|
||||||
animatedSprite.Animation = "move_side";
|
animatedSprite.Animation = "move_side";
|
||||||
animatedSprite.FlipH = movement.X < 0.5;
|
animatedSprite.FlipH = movement.X < 0.5;
|
||||||
animatedSprite.SpeedScale = Math.Abs(movement.X * speed/150);
|
animatedSprite.SpeedScale = Math.Abs(movement.X * speed / 150);
|
||||||
}
|
}
|
||||||
else if (Math.Round(movement.Y, 0) != 0)
|
else if (Math.Round(movement.Y, 0) != 0)
|
||||||
{
|
{
|
||||||
if (movement.Y > 0.05) animatedSprite.Animation = "move_down";
|
if (movement.Y > 0.05) animatedSprite.Animation = "move_down";
|
||||||
if (movement.Y < 0.05) animatedSprite.Animation = "move_up";
|
if (movement.Y < 0.05) animatedSprite.Animation = "move_up";
|
||||||
animatedSprite.FlipH = false;
|
animatedSprite.FlipH = false;
|
||||||
animatedSprite.SpeedScale = Math.Abs(movement.Y * speed/150);
|
animatedSprite.SpeedScale = Math.Abs(movement.Y * speed / 150);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
theme/main-theme.tres
Normal file
26
theme/main-theme.tres
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
[gd_resource type="Theme" load_steps=3 format=3 uid="uid://drfpgi5fnigok"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4bp5o"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fdtmb"]
|
||||||
|
content_margin_left = 4.0
|
||||||
|
content_margin_top = 4.0
|
||||||
|
content_margin_right = 4.0
|
||||||
|
content_margin_bottom = 4.0
|
||||||
|
bg_color = Color(0.13125, 0.15, 0.18125, 1)
|
||||||
|
border_color = Color(0.084, 0.096, 0.116, 1)
|
||||||
|
corner_radius_top_left = 3
|
||||||
|
corner_radius_top_right = 3
|
||||||
|
corner_radius_bottom_right = 3
|
||||||
|
corner_radius_bottom_left = 3
|
||||||
|
corner_detail = 3
|
||||||
|
anti_aliasing = false
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
RichTextLabel/colors/default_color = Color(0.8025, 0.81, 0.8225, 1)
|
||||||
|
RichTextLabel/colors/font_shadow_color = Color(0, 0, 0, 0)
|
||||||
|
RichTextLabel/constants/shadow_offset_x = 1
|
||||||
|
RichTextLabel/constants/shadow_offset_y = 1
|
||||||
|
RichTextLabel/constants/shadow_outline_size = 1
|
||||||
|
RichTextLabel/styles/focus = SubResource("StyleBoxEmpty_4bp5o")
|
||||||
|
RichTextLabel/styles/normal = SubResource("StyleBoxFlat_fdtmb")
|
Reference in New Issue
Block a user