From 331949426ac0c89f458fd55f7504d480458b4a79 Mon Sep 17 00:00:00 2001 From: Victor Turgeon Date: Tue, 11 Oct 2022 15:20:45 -0400 Subject: [PATCH 1/3] Basic crosshair, pi ajout de layer pour le HUD --- HUD.tscn | 41 +++++++++++++++++++++++++++++------------ Player.gd | 4 ++-- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/HUD.tscn b/HUD.tscn index c877389..a00a450 100644 --- a/HUD.tscn +++ b/HUD.tscn @@ -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"] diff --git a/Player.gd b/Player.gd index f396c08..3ab61a5 100644 --- a/Player.gd +++ b/Player.gd @@ -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 From c972765b3204d5dc60ae74dd4e571790b5bac909 Mon Sep 17 00:00:00 2001 From: Victor Turgeon Date: Tue, 11 Oct 2022 15:25:08 -0400 Subject: [PATCH 2/3] bruyh --- Player.tscn | 3 --- Start.gd | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Player.tscn b/Player.tscn index 6cf0138..c753af9 100644 --- a/Player.tscn +++ b/Player.tscn @@ -124,15 +124,12 @@ anims/basic_slap = SubResource( 6 ) [node name="AudioSlap" type="AudioStreamPlayer3D" parent="."] stream = ExtResource( 5 ) -bus = "SFX" [node name="AudioMegaSlap" type="AudioStreamPlayer3D" parent="."] stream = ExtResource( 6 ) -bus = "SFX" emission_angle_enabled = true doppler_tracking = 2 [node name="Music" type="AudioStreamPlayer" parent="."] volume_db = 13.983 autoplay = true -bus = "Music" diff --git a/Start.gd b/Start.gd index 0349e1f..3ffa41e 100644 --- a/Start.gd +++ b/Start.gd @@ -7,7 +7,7 @@ onready var QuitDesktop = $"Quit to Desktop" onready var Music = $"MenuMusic" func _ready(): - Music.play() + #Music.play() self.show() get_tree().paused = true QuitGame.hide() @@ -23,7 +23,7 @@ func _on_New_Game_pressed(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) get_tree().paused = false ingame = true - Music.stop() + #Music.stop() func openMenu(): if (ingame): From 463f1c5cdaac2174bf24c638116df71820b2f39f Mon Sep 17 00:00:00 2001 From: Victor Turgeon Date: Tue, 11 Oct 2022 15:41:00 -0400 Subject: [PATCH 3/3] Resized enemy --- HUD.tscn | 2 +- Scenes/Enemy.tscn | 5 +++-- Start.gd | 4 ++-- Test_Scene.tscn | 6 +++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/HUD.tscn b/HUD.tscn index 5a2c849..9c99460 100644 --- a/HUD.tscn +++ b/HUD.tscn @@ -149,7 +149,7 @@ margin_right = 1062.0 margin_bottom = 653.0 text = "Quit Game" -[node name="MenuMusic" type="AudioStreamPlayer" parent="."] +[node name="MenuMusic" type="AudioStreamPlayer" parent="MenuLayer/Start"] [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"] diff --git a/Scenes/Enemy.tscn b/Scenes/Enemy.tscn index bd2e9f2..686c358 100644 --- a/Scenes/Enemy.tscn +++ b/Scenes/Enemy.tscn @@ -9,12 +9,13 @@ [node name="Enemy" type="KinematicBody"] [node name="MeshInstance" type="MeshInstance" parent="."] +transform = Transform( 0.6, 0, 0, 0, 0.6, 0, 0, 0, 0.6, 0, 0, 0 ) mesh = ExtResource( 1 ) [node name="BodyCollision" type="CollisionShape" parent="."] -transform = Transform( 0.914478, 0, 0, 0, 1.50713, 0, 0, 0, 0.383312, 0, 0.642072, 0 ) +transform = Transform( 0.914478, 0, 0, 0, 1.50713, 0, 0, 0, 0.383312, 0, -0.479353, 0 ) shape = SubResource( 1 ) [node name="Head" type="CollisionShape" parent="."] -transform = Transform( 0.761117, 0, 0, 0, 1.04862, 0, 0, 0, 0.761117, 0, 3.5714, 0 ) +transform = Transform( 0.528959, 0, 0, 0, 0.728767, 0, 0, 0, 0.528959, 0, 1.87623, 0 ) shape = SubResource( 2 ) diff --git a/Start.gd b/Start.gd index 3ffa41e..0349e1f 100644 --- a/Start.gd +++ b/Start.gd @@ -7,7 +7,7 @@ onready var QuitDesktop = $"Quit to Desktop" onready var Music = $"MenuMusic" func _ready(): - #Music.play() + Music.play() self.show() get_tree().paused = true QuitGame.hide() @@ -23,7 +23,7 @@ func _on_New_Game_pressed(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) get_tree().paused = false ingame = true - #Music.stop() + Music.stop() func openMenu(): if (ingame): diff --git a/Test_Scene.tscn b/Test_Scene.tscn index 17ba975..c21408c 100644 --- a/Test_Scene.tscn +++ b/Test_Scene.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://Materials/Dark_ProtoMat.tres" type="Material" id=1] [ext_resource path="res://Player.tscn" type="PackedScene" id=2] [ext_resource path="res://Materials/Orange_ProtoMat.tres" type="Material" id=3] [ext_resource path="res://AllSkyFree_Skyboxes/Epic_BlueSunset_EquiRect_flat.png" type="Texture" id=4] +[ext_resource path="res://Scenes/Enemy.tscn" type="PackedScene" id=5] [sub_resource type="PanoramaSky" id=1] panorama = ExtResource( 4 ) @@ -65,3 +66,6 @@ transform = Transform( 1, 0, 0, 0, 0.849579, 0.527461, 0, -0.527461, 0.849579, 0 light_color = Color( 1, 0.924276, 0.869018, 1 ) light_specular = 1.0 shadow_enabled = true + +[node name="Enemy" parent="." instance=ExtResource( 5 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.367474, 2.61222, -26.0531 )