From 851a9fa99c9d7802ccca99f07da78c6e4ff2b8d9 Mon Sep 17 00:00:00 2001 From: cmod31 Date: Fri, 24 Feb 2023 17:43:03 +0100 Subject: [PATCH] lots of bugfixes --- scenes/base_npc.tscn | 4 ++-- scenes/gui/console.tscn | 4 ++++ scenes/player.tscn | 2 +- scenes/tiles/first_debug_tile.tscn | 12 ++++++------ src/essential.cs | 13 ++++++++----- src/scene-scripts/dialogue-system/dialog_bubble.cs | 3 ++- src/scene-scripts/player.cs | 10 ++++++++-- 7 files changed, 31 insertions(+), 17 deletions(-) diff --git a/scenes/base_npc.tscn b/scenes/base_npc.tscn index a2457cd..032d5d1 100644 --- a/scenes/base_npc.tscn +++ b/scenes/base_npc.tscn @@ -88,7 +88,7 @@ radius = 9.0 height = 60.0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_sgrqb"] -size = Vector2(64, 100) +size = Vector2(64, 79) [node name="base_npc" type="CharacterBody2D"] @@ -112,7 +112,7 @@ title = "Debug NPC" metadata/_edit_lock_ = true [node name="collision_shape_2d" parent="dialog_trigger_area" index="0"] +position = Vector2(0, -10.5) shape = SubResource("RectangleShape2D_sgrqb") -metadata/_edit_lock_ = true [editable path="dialog_trigger_area"] diff --git a/scenes/gui/console.tscn b/scenes/gui/console.tscn index dc5cb15..4195fbc 100644 --- a/scenes/gui/console.tscn +++ b/scenes/gui/console.tscn @@ -6,6 +6,7 @@ transparent_bg = true size = Vector2i(1537, 193) visible = true +always_on_top = true script = ExtResource("1_gdt1r") [node name="v_box_container" type="VBoxContainer" parent="."] @@ -39,5 +40,8 @@ caret_blink = true caret_blink_interval = 0.5 caret_force_displayed = true +[node name="cheatcode_timer" type="Timer" parent="."] +one_shot = true + [connection signal="popup_hide" from="." to="." method="OnPopupHide"] [connection signal="text_submitted" from="v_box_container/line_edit" to="." method="OnLineEditTextSubmitted"] diff --git a/scenes/player.tscn b/scenes/player.tscn index ffec80c..01128d8 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -98,7 +98,7 @@ metadata/_edit_lock_ = true [node name="ray_cast_2d" type="RayCast2D" parent="rotation_center"] rotation = 3.14159 -target_position = Vector2(-64, 0) +target_position = Vector2(-32, 0) collision_mask = 2 hit_from_inside = true collide_with_areas = true diff --git a/scenes/tiles/first_debug_tile.tscn b/scenes/tiles/first_debug_tile.tscn index 92d7572..b2b9287 100644 --- a/scenes/tiles/first_debug_tile.tscn +++ b/scenes/tiles/first_debug_tile.tscn @@ -2,15 +2,15 @@ [ext_resource type="Texture2D" uid="uid://diwxy1fl5m02y" path="res://assets/textures/debug/debugitem_one64.png" id="1_2m632"] -[sub_resource type="CircleShape2D" id="CircleShape2D_2d5dy"] -radius = 30.8058 +[sub_resource type="CircleShape2D" id="CircleShape2D_qgi6t"] +radius = 33.1361 -[node name="first_debug_tile" type="RigidBody2D"] +[node name="rigid_body_2d" type="RigidBody2D"] gravity_scale = 0.0 [node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(0, -4) texture = ExtResource("1_2m632") -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -position = Vector2(-1, 4) -shape = SubResource("CircleShape2D_2d5dy") +[node name="collision_shape_2d" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_qgi6t") diff --git a/src/essential.cs b/src/essential.cs index aed312a..9e05934 100644 --- a/src/essential.cs +++ b/src/essential.cs @@ -3,17 +3,20 @@ using System; public partial class essential : Node { - public string currentController = Input.GetJoyName(0); + public static string currentController = Input.GetJoyName(0); public override void _Input(InputEvent @event) { - //Checks if using Keyboard or controller and giving out current controller - if (@event is InputEventKey || @event is InputEventMouseButton || currentController == "") + //Checks if using Keyboard or controller. It gives out the current controller and changes cursor visibillity + if (@event is InputEventKey || @event is InputEventMouseButton || @event is InputEventMouseMotion || currentController == "") + { currentController = "PC"; - if (@event is InputEventJoypadButton && currentController != Input.GetJoyName(0)) + Input.MouseMode = Input.MouseModeEnum.Visible; + } + if (@event is InputEventJoypadButton || @event is InputEventJoypadMotion & Input.GetVector("move_left", "move_right", "move_up", "move_down") != Vector2.Zero && currentController != Input.GetJoyName(0)) { currentController = Input.GetJoyName(0); - console.Print("Current controller device: " + currentController); + Input.MouseMode = Input.MouseModeEnum.Hidden; } } public override void _Process(double delta) diff --git a/src/scene-scripts/dialogue-system/dialog_bubble.cs b/src/scene-scripts/dialogue-system/dialog_bubble.cs index f855168..75c35b3 100644 --- a/src/scene-scripts/dialogue-system/dialog_bubble.cs +++ b/src/scene-scripts/dialogue-system/dialog_bubble.cs @@ -36,7 +36,8 @@ public partial class dialog_bubble : CanvasLayer if (parsedDlg.AsGodotDictionary()["dialogType"].AsString() != "villager" || introducedVillager) GetNode