Browse Source

Fixed failing HUD referencing in Player.gd

unbroken
unfa 10 months ago
parent
commit
004247e8bf
  1. 1
      .gitattributes
  2. 29
      Game/Assets/Characters/Player.gd
  3. 52
      Game/Assets/HUD/HUD.tscn
  4. 14
      Game/Map.tscn

1
.gitattributes

@ -2,3 +2,4 @@
*.wav filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

29
Game/Assets/Characters/Player.gd

@ -3,9 +3,12 @@ extends CharacterBody3D
@export var mouse_sensitivity := 0.35
#var speed := 15
var hud: Node
var crosshair: Node
var vignette: Node
@onready var hud = get_tree().root.get_node("Main").get_node("HUD")
@onready var crosshair = hud.get_node("Crosshair")
@onready var vignette = hud.get_node("Vignette")
@onready var head = $Head
@onready var camera = $Head/Camera
@onready var tween = $Head/Camera/Tween
@ -108,10 +111,6 @@ var gravity_vec := Vector3.ZERO
head.set_rotation(head_rotation)
func _ready() -> void:
hud = get_tree().root.find_node("HUD", true, false)
crosshair = hud.get_node("Crosshair")
vignette = hud.get_node("Vignette")
#Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
view_zoom = 1.0
@ -146,14 +145,18 @@ func _input(event) -> void:
return
if Input.is_action_just_pressed("view_zoom"):
tween.remove_all()
tween.interpolate_property(self, "view_zoom", view_zoom, 4.0, 0.5, Tween.TRANS_SINE, Tween.EASE_IN_OUT)
tween.start()
# tween.remove_all()
# tween.interpolate_property(self, "view_zoom", view_zoom, 4.0, 0.5, Tween.TRANS_SINE, Tween.EASE_IN_OUT)
# tween.start()
view_zoom = 4.0
if Input.is_action_just_released("view_zoom"):
tween.remove_all()
tween.interpolate_property(self, "view_zoom", view_zoom, 1.0, 0.25, Tween.TRANS_SINE, Tween.EASE_IN_OUT)
tween.start()
# tween.remove_all()
# tween.interpolate_property(self, "view_zoom", view_zoom, 1.0, 0.25, Tween.TRANS_SINE, Tween.EASE_IN_OUT)
# tween.start()
view_zoom = 1.0
# rpc_unreliable(&'aim', event)
aim(event)

52
Game/Assets/HUD/HUD.tscn

@ -18,10 +18,10 @@ tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0 ),
"transitions": PackedFloat32Array( 1 ),
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ) ]
"values": [Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id=2]
@ -34,10 +34,10 @@ tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 0.1, 0.2 ),
"transitions": PackedFloat32Array( 1, 1, 1 ),
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [ Color( 1, 0.716667, 0, 1 ), Color( 1, 0.716667, 0, 1 ), Color( 1, 1, 1, 1 ) ]
"values": [Color(1, 0.716667, 0, 1), Color(1, 0.716667, 0, 1), Color(1, 1, 1, 1)]
}
tracks/1/type = "audio"
tracks/1/path = NodePath("Hit_Confirmation")
@ -46,12 +46,12 @@ tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"clips": [ {
"clips": [{
"end_offset": 0.0,
"start_offset": 0.0,
"stream": ExtResource( 4 )
} ],
"times": PackedFloat32Array( 0 )
}],
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id=3]
@ -64,10 +64,10 @@ tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PackedFloat32Array( 0, 0.25, 0.5 ),
"transitions": PackedFloat32Array( 1, 1, 1 ),
"times": PackedFloat32Array(0, 0.25, 0.5),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [ Color( 1, 0.0532926, 0, 1 ), Color( 1, 0.0532926, 0, 1 ), Color( 1, 1, 1, 1 ) ]
"values": [Color(1, 0.0532926, 0, 1), Color(1, 0.0532926, 0, 1), Color(1, 1, 1, 1)]
}
tracks/1/type = "audio"
tracks/1/path = NodePath("Hit_Confirmation")
@ -76,12 +76,12 @@ tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"clips": [ {
"clips": [{
"end_offset": 0.0,
"start_offset": 0.0,
"stream": ExtResource( 3 )
} ],
"times": PackedFloat32Array( 0 )
}],
"times": PackedFloat32Array(0)
}
[node name="HUD" type="Control"]
@ -112,7 +112,7 @@ offset_left = -32.0
offset_top = -32.0
offset_right = 96.0
offset_bottom = 96.0
rect_scale = Vector2( 0.5, 0.5 )
rect_scale = Vector2(0.5, 0.5)
texture = ExtResource( 2 )
expand = true
script = null
@ -125,7 +125,7 @@ autoplay = "Default"
anims/Default = SubResource( 1 )
anims/Hit = SubResource( 2 )
anims/Kill = SubResource( 3 )
blend_times = [ ]
blend_times = []
script = null
[node name="Hit_Confirmation" type="AudioStreamPlayer" parent="Crosshair"]
@ -166,13 +166,13 @@ __meta__ = {
offset_top = 37.0
offset_right = 300.0
offset_bottom = 507.0
rect_min_size = Vector2( 0, 470 )
rect_min_size = Vector2(0, 470)
theme = ExtResource( 7 )
bbcode_enabled = true
scroll_active = false
scroll_following = true
custom_effects = [ ]
structured_text_bidi_override_options = [ ]
custom_effects = []
structured_text_bidi_override_options = []
script = null
__meta__ = {
"_edit_use_anchors_": false
@ -181,7 +181,7 @@ __meta__ = {
[node name="Typing" type="HBoxContainer" parent="Chat/VBoxContainer"]
visible = false
offset_top = 474.0
offset_right = 339.0
offset_right = 309.0
offset_bottom = 507.0
script = null
__meta__ = {
@ -192,9 +192,9 @@ __meta__ = {
offset_top = 3.0
offset_right = 55.0
offset_bottom = 29.0
rect_min_size = Vector2( 55, 0 )
rect_min_size = Vector2(55, 0)
text = "say: "
structured_text_bidi_override_options = [ ]
structured_text_bidi_override_options = []
script = null
__meta__ = {
"_edit_use_anchors_": false
@ -202,16 +202,16 @@ __meta__ = {
[node name="Editor" type="LineEdit" parent="Chat/VBoxContainer/Typing"]
offset_left = 59.0
offset_right = 339.0
offset_right = 309.0
offset_bottom = 33.0
rect_min_size = Vector2( 250, 0 )
rect_min_size = Vector2(250, 0)
max_length = 80
expand_to_text_length = true
context_menu_enabled = false
virtual_keyboard_enabled = false
shortcut_keys_enabled = false
selecting_enabled = false
structured_text_bidi_override_options = [ ]
structured_text_bidi_override_options = []
placeholder_text = "ENTER to send, ESC to cancel"
placeholder_alpha = 0.5
caret_blink = true

14
Game/Map.tscn

File diff suppressed because one or more lines are too long