From 7b48cd583de3e293b98bc1198cb5dd491843bc5d Mon Sep 17 00:00:00 2001 From: Dendy Faist Date: Fri, 6 Mar 2026 10:47:52 +0100 Subject: [PATCH] feat: Make arrow be a 2D control grabbing rotation from the 3D one --- level.tscn | 2 +- player.gd | 1 + player.tscn | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/level.tscn b/level.tscn index 775f541..e382845 100644 --- a/level.tscn +++ b/level.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" uid="uid://dj0cgqed5n3ys" path="res://level.gd" id="1_0b4ue"] [ext_resource type="PackedScene" uid="uid://cmb3b7xrlboy3" path="res://player.tscn" id="1_u52ul"] [ext_resource type="Script" uid="uid://b5ebibi08tjvd" path="res://camera_3d.gd" id="2_vonw3"] -[ext_resource type="Script" path="res://special_camera.gd" id="4_0b4ue"] +[ext_resource type="Script" uid="uid://oy8s25dl6g4a" path="res://special_camera.gd" id="4_0b4ue"] [sub_resource type="Environment" id="Environment_vonw3"] ambient_light_source = 2 diff --git a/player.gd b/player.gd index 58a11ca..589df42 100644 --- a/player.gd +++ b/player.gd @@ -54,6 +54,7 @@ func _process(delta: float) -> void: return $Arrow.look_at(Global.station_coords) + $HUD/ArrowTextureRect.rotation = -$Arrow.rotation.y $HUD/StaminaRect.scale.x = stamina / max_stamina $HUD/StageLabel.text = "Stage %d" % [stage_counter + 1] diff --git a/player.tscn b/player.tscn index c8947d9..de98285 100644 --- a/player.tscn +++ b/player.tscn @@ -66,6 +66,7 @@ one_shot = true visible = false [node name="FinishControl" type="Control" parent="." unique_id=1717901238] +visible = false layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -244,7 +245,6 @@ grow_vertical = 2 text = "Reiniciar" [node name="HUD" type="Control" parent="." unique_id=1781259393] -visible = false layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -284,6 +284,20 @@ offset_right = 110.0 offset_bottom = 64.0 color = Color(0.8197299, 0.0039063096, 0.18416114, 1) +[node name="ArrowTextureRect" type="TextureRect" parent="HUD" unique_id=185112609] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -20.5 +offset_top = 56.0 +offset_right = 20.5 +offset_bottom = 100.0 +grow_horizontal = 2 +pivot_offset_ratio = Vector2(0.5, 0.5) +texture = ExtResource("4_hqtel") +expand_mode = 1 + [node name="Hurtbox" type="Area3D" parent="." unique_id=2004081669] [node name="Collision" type="CollisionShape3D" parent="Hurtbox" unique_id=1101412773] @@ -304,6 +318,7 @@ debug_color = Color(0.6328197, 0.113640614, 0, 0.41960785) [node name="Arrow" type="MeshInstance3D" parent="." unique_id=870899544] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 0) +visible = false mesh = SubResource("PlaneMesh_sweqy") surface_material_override/0 = SubResource("StandardMaterial3D_2hs0m")