Basic crosshair, pi ajout de layer pour le HUD

This commit is contained in:
Victor Turgeon 2022-10-11 15:20:45 -04:00
parent 95a96d10a5
commit 331949426a
2 changed files with 31 additions and 14 deletions

View File

@ -61,7 +61,21 @@ font_data = ExtResource( 3 )
[node name="HUD" type="CanvasLayer"]
follow_viewport_enable = true
[node name="ActualHUD" type="Control" parent="."]
[node name="PlayerLayer" type="CanvasLayer" parent="."]
layer = 0
[node name="Crosshair" type="ColorRect" parent="PlayerLayer"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -3.0
margin_top = -3.0
margin_right = 3.0
margin_bottom = 3.0
rect_min_size = Vector2( 6, 6 )
[node name="ActualHUD" type="Control" parent="PlayerLayer"]
anchor_left = 0.037
anchor_top = 0.914
anchor_right = 0.037
@ -70,13 +84,13 @@ margin_right = 40.0
margin_bottom = 40.0
theme = SubResource( 8 )
[node name="SlapGauge" type="ColorRect" parent="ActualHUD"]
[node name="SlapGauge" type="ColorRect" parent="PlayerLayer/ActualHUD"]
material = SubResource( 11 )
margin_right = 291.36
margin_bottom = 23.0
script = ExtResource( 1 )
[node name="SlapLabel" type="Label" parent="ActualHUD/SlapGauge"]
[node name="SlapLabel" type="Label" parent="PlayerLayer/ActualHUD/SlapGauge"]
modulate = Color( 1, 1, 1, 0.611765 )
anchor_left = 12.662
anchor_top = 7.324
@ -88,7 +102,10 @@ margin_right = -3572.2
margin_bottom = -137.452
text = "Slap"
[node name="Start" type="Control" parent="."]
[node name="MenuLayer" type="CanvasLayer" parent="."]
layer = 2
[node name="Start" type="Control" parent="MenuLayer"]
pause_mode = 2
visible = false
margin_right = 40.0
@ -96,14 +113,14 @@ margin_bottom = 40.0
theme = SubResource( 8 )
script = ExtResource( 2 )
[node name="Background" type="ColorRect" parent="Start"]
[node name="Background" type="ColorRect" parent="MenuLayer/Start"]
margin_left = -4.0
margin_top = -8.0
margin_right = 1927.0
margin_bottom = 1085.0
color = Color( 0.14902, 0.121569, 0.121569, 1 )
[node name="Title" type="Label" parent="Start"]
[node name="Title" type="Label" parent="MenuLayer/Start"]
margin_left = 532.0
margin_top = 353.0
margin_right = 1414.0
@ -111,27 +128,27 @@ margin_bottom = 455.0
custom_fonts/font = SubResource( 7 )
text = "FIRST PERSON SLAPPER"
[node name="New Game" type="Button" parent="Start"]
[node name="New Game" type="Button" parent="MenuLayer/Start"]
margin_left = 886.0
margin_top = 554.0
margin_right = 1061.0
margin_bottom = 598.0
text = "New Game"
[node name="Quit to Desktop" type="Button" parent="Start"]
[node name="Quit to Desktop" type="Button" parent="MenuLayer/Start"]
margin_left = 887.0
margin_top = 664.0
margin_right = 1062.0
margin_bottom = 708.0
text = "Quit to Desktop"
[node name="Quit Game" type="Button" parent="Start"]
[node name="Quit Game" type="Button" parent="MenuLayer/Start"]
margin_left = 887.0
margin_top = 609.0
margin_right = 1062.0
margin_bottom = 653.0
text = "Quit Game"
[connection signal="pressed" from="Start/New Game" to="Start" method="_on_New_Game_pressed"]
[connection signal="pressed" from="Start/Quit to Desktop" to="Start" method="_on_Quit_to_Desktop_Button_pressed"]
[connection signal="pressed" from="Start/Quit Game" to="Start" method="_on_Quit_Game_pressed"]
[connection signal="pressed" from="MenuLayer/Start/New Game" to="MenuLayer/Start" method="_on_New_Game_pressed"]
[connection signal="pressed" from="MenuLayer/Start/Quit to Desktop" to="MenuLayer/Start" method="_on_Quit_to_Desktop_Button_pressed"]
[connection signal="pressed" from="MenuLayer/Start/Quit Game" to="MenuLayer/Start" method="_on_Quit_Game_pressed"]

View File

@ -24,9 +24,9 @@ var gravity_vec = Vector3()
onready var head = $Head
onready var ground_check = $GroundCheck
onready var slap_gauge = $HUD/ActualHUD/SlapGauge
onready var slap_gauge = $HUD/PlayerLayer/ActualHUD/SlapGauge
onready var slap_animator = $HandMovement
onready var Menu = $HUD/Start
onready var Menu = $HUD/MenuLayer/Start
onready var AudioSlap = $AudioSlap
onready var AudioMegaSlap = $AudioMegaSlap