feat: Make arrow be a 2D control grabbing rotation from the 3D one

This commit is contained in:
Dendy 2026-03-06 10:47:52 +01:00
parent e1dc2f7420
commit 7b48cd583d
3 changed files with 18 additions and 2 deletions

View File

@ -3,7 +3,7 @@
[ext_resource type="Script" uid="uid://dj0cgqed5n3ys" path="res://level.gd" id="1_0b4ue"] [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="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" 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"] [sub_resource type="Environment" id="Environment_vonw3"]
ambient_light_source = 2 ambient_light_source = 2

View File

@ -54,6 +54,7 @@ func _process(delta: float) -> void:
return return
$Arrow.look_at(Global.station_coords) $Arrow.look_at(Global.station_coords)
$HUD/ArrowTextureRect.rotation = -$Arrow.rotation.y
$HUD/StaminaRect.scale.x = stamina / max_stamina $HUD/StaminaRect.scale.x = stamina / max_stamina
$HUD/StageLabel.text = "Stage %d" % [stage_counter + 1] $HUD/StageLabel.text = "Stage %d" % [stage_counter + 1]

View File

@ -66,6 +66,7 @@ one_shot = true
visible = false visible = false
[node name="FinishControl" type="Control" parent="." unique_id=1717901238] [node name="FinishControl" type="Control" parent="." unique_id=1717901238]
visible = false
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -244,7 +245,6 @@ grow_vertical = 2
text = "Reiniciar" text = "Reiniciar"
[node name="HUD" type="Control" parent="." unique_id=1781259393] [node name="HUD" type="Control" parent="." unique_id=1781259393]
visible = false
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -284,6 +284,20 @@ offset_right = 110.0
offset_bottom = 64.0 offset_bottom = 64.0
color = Color(0.8197299, 0.0039063096, 0.18416114, 1) 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="Hurtbox" type="Area3D" parent="." unique_id=2004081669]
[node name="Collision" type="CollisionShape3D" parent="Hurtbox" unique_id=1101412773] [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] [node name="Arrow" type="MeshInstance3D" parent="." unique_id=870899544]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 0)
visible = false
mesh = SubResource("PlaneMesh_sweqy") mesh = SubResource("PlaneMesh_sweqy")
surface_material_override/0 = SubResource("StandardMaterial3D_2hs0m") surface_material_override/0 = SubResource("StandardMaterial3D_2hs0m")