diff --git a/scenes/main.tscn b/scenes/main.tscn index 3514ac5..7c99b14 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -8,4 +8,4 @@ [node name="first_world" parent="." instance=ExtResource("2_x8nyb")] [node name="player" parent="." instance=ExtResource("1_p5d84")] -playerName = "PlayerName" +playerName = "Yannik" diff --git a/scenes/player.tscn b/scenes/player.tscn index 2f78f6e..c81813e 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -91,6 +91,7 @@ height = 45.968 [node name="player" type="CharacterBody2D"] process_mode = 1 y_sort_enabled = true +position = Vector2(-1, 0) script = ExtResource("1_qehox") [node name="rotation_center" type="Marker2D" parent="."] diff --git a/src/scene-scripts/dialogue-system/dialog_bubble.cs b/src/scene-scripts/dialogue-system/dialog_bubble.cs index e085401..57916b9 100644 --- a/src/scene-scripts/dialogue-system/dialog_bubble.cs +++ b/src/scene-scripts/dialogue-system/dialog_bubble.cs @@ -28,8 +28,10 @@ public partial class dialog_bubble : CanvasLayer public void WelcomeDialog() { string[] welcomeText = parsedDlg.AsGodotDictionary()["welcome"].AsStringArray(); + Godot.Collections.Dictionary playerbeginoptions = parsedDlg.AsGodotDictionary()["playerbeginoptions"].AsGodotDictionary(); + GD.Randomize(); dlgLines.Add(welcomeText[GD.Randi() % welcomeText.Length]); - MakeAnswerBox(new string[] { "talk", "go away" }); + MakeAnswerBox(new string[] { playerbeginoptions["talk"].AsStringArray()[GD.Randi() % playerbeginoptions["talk"].AsStringArray().Length], playerbeginoptions["goaway"].AsStringArray()[GD.Randi() % playerbeginoptions["goaway"].AsStringArray().Length] }); } public void CloseDialog() { @@ -61,7 +63,7 @@ public partial class dialog_bubble : CanvasLayer if (dlgPointer > dlgLines.Count) CloseDialog(); - //AnswerBox wait for typewrite effect to finish + //AnswerBox wait for typewrite effect to finish (garbage code) GetNode("box/panel_container").Visible = richText.VisibleCharacters == -1 | Regex.Replace(richText.Text, @"\[[^]]+\]", "").Length == richText.VisibleCharacters && GetNode("box/panel_container/margin_container/v_box_container").GetChildCount() == dialogOptionsLength; } public void MakeAnswerBox(string[] dialogOptions) @@ -70,6 +72,7 @@ public partial class dialog_bubble : CanvasLayer var parent = GetNode("box/panel_container/margin_container/v_box_container"); for (int i = 0; parent.GetChildCount() < dialogOptions.Length; i++) { + //remove button nodes for randomizing parent.AddChild(button.Instantiate()); parent.GetChild