From 4317aa5956fc24994852aa0559112737b25df37d Mon Sep 17 00:00:00 2001 From: SyntaX Date: Sun, 24 Nov 2019 11:21:44 +0100 Subject: [PATCH] moved hud stuff into HUD scene --- WikiJam/Player/Player.tscn | 75 ++------------------------------------ WikiJam/Player/UI/HUD.tscn | 71 +++++++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 72 deletions(-) diff --git a/WikiJam/Player/Player.tscn b/WikiJam/Player/Player.tscn index 129ac5c..356ef40 100644 --- a/WikiJam/Player/Player.tscn +++ b/WikiJam/Player/Player.tscn @@ -1,11 +1,10 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://Player/Player.gd" type="Script" id=1] [ext_resource path="res://Player/Footsteps.gd" type="Script" id=2] [ext_resource path="res://Resources/Audio/Step.wav" type="AudioStream" id=3] [ext_resource path="res://Player/UI/HUD.tscn" type="PackedScene" id=4] -[ext_resource path="res://Player/UI/HUD.gd" type="Script" id=5] -[ext_resource path="res://Sounds/dino-eat.wav" type="AudioStream" id=6] +[ext_resource path="res://Sounds/dino-eat.wav" type="AudioStream" id=5] [sub_resource type="CylinderShape" id=1] height = 2.5 @@ -80,79 +79,13 @@ unit_db = -10.0 pitch_scale = 1.5 [node name="HUD" parent="." instance=ExtResource( 4 )] -script = ExtResource( 5 ) -label_nodepath = NodePath("LabelScore") -popup_nodepath = NodePath("PopupWon") -gameover_sound_path = NodePath("../GameOverSound") - -[node name="LabelScore" type="Label" parent="HUD"] -margin_left = 15.0 -margin_top = 15.0 -margin_right = 115.0 -margin_bottom = 30.0 -text = "Score: 0" - -[node name="PopupWon" type="Popup" parent="HUD"] -visible = true -margin_left = 383.0 -margin_top = 187.0 -margin_right = 530.0 -margin_bottom = 289.0 - -[node name="PanelFail" type="Panel" parent="HUD/PopupWon"] -modulate = Color( 0.996078, 0, 0, 1 ) -margin_left = -383.0 -margin_top = -187.36 -margin_right = 641.0 -margin_bottom = 412.64 - -[node name="PanelWon" type="Panel" parent="HUD/PopupWon"] -modulate = Color( 0.0313726, 0, 0.996078, 1 ) -margin_left = -383.0 -margin_top = -187.36 -margin_right = 641.0 -margin_bottom = 412.64 - -[node name="LabelWon" type="Label" parent="HUD/PopupWon"] -margin_left = 87.064 -margin_top = 24.4867 -margin_right = 169.064 -margin_bottom = 72.4867 -text = "Gratulations! - - You Won!" - -[node name="LabelFail" type="Label" parent="HUD/PopupWon"] -margin_left = 88.9828 -margin_top = 28.0094 -margin_right = 168.983 -margin_bottom = 76.0094 -text = " You died! - -Game over" - -[node name="Button" type="Button" parent="HUD/PopupWon"] -margin_left = 86.5054 -margin_top = 144.902 -margin_right = 179.505 -margin_bottom = 181.902 -text = "play again" - -[node name="ProgressBar" type="ProgressBar" parent="HUD"] -margin_left = 410.651 -margin_top = 560.551 -margin_right = 614.651 -margin_bottom = 582.551 -step = 1.0 -value = 100.0 [node name="GameOverSound" type="AudioStreamPlayer" parent="."] -stream = ExtResource( 6 ) +stream = ExtResource( 5 ) [node name="InteractArea" type="Area" parent="."] gravity = 0.0 [node name="CollisionShape" type="CollisionShape" parent="InteractArea"] -transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 2, 0 ) +transform = Transform( 1, 0, 0, 0, -4.37114e-008, -1, 0, 1, -4.37114e-008, 0, 2, 0 ) shape = SubResource( 3 ) -[connection signal="pressed" from="HUD/PopupWon/Button" to="HUD" method="_on_Button_pressed"] diff --git a/WikiJam/Player/UI/HUD.tscn b/WikiJam/Player/UI/HUD.tscn index 9878b86..d69ac8b 100644 --- a/WikiJam/Player/UI/HUD.tscn +++ b/WikiJam/Player/UI/HUD.tscn @@ -1,5 +1,74 @@ -[gd_scene format=2] +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Player/UI/HUD.gd" type="Script" id=1] [node name="HUD" type="Control"] margin_right = 40.0 margin_bottom = 40.0 +script = ExtResource( 1 ) +label_nodepath = NodePath("../HUD/LabelScore") +popup_nodepath = NodePath("../HUD/Popup") +gameover_sound_path = NodePath("../GameOverSound") + +[node name="LabelScore" type="Label" parent="."] +margin_left = 15.0 +margin_top = 15.0 +margin_right = 115.0 +margin_bottom = 30.0 +text = "Score: 0" + +[node name="Popup" type="Popup" parent="."] +editor/display_folded = true +visible = true +margin_left = 383.0 +margin_top = 187.0 +margin_right = 530.0 +margin_bottom = 289.0 + +[node name="PanelFail" type="Panel" parent="Popup"] +modulate = Color( 0.996078, 0, 0, 1 ) +margin_left = -383.0 +margin_top = -187.36 +margin_right = 641.0 +margin_bottom = 412.64 + +[node name="PanelWon" type="Panel" parent="Popup"] +modulate = Color( 0.0313726, 0, 0.996078, 1 ) +margin_left = -383.0 +margin_top = -187.36 +margin_right = 641.0 +margin_bottom = 412.64 + +[node name="LabelWon" type="Label" parent="Popup"] +margin_left = 87.064 +margin_top = 24.4867 +margin_right = 169.064 +margin_bottom = 72.4867 +text = "Gratulations! + + You Won!" + +[node name="LabelFail" type="Label" parent="Popup"] +margin_left = 88.9828 +margin_top = 28.0094 +margin_right = 168.983 +margin_bottom = 76.0094 +text = " You died! + +Game over" + +[node name="Button" type="Button" parent="Popup"] +margin_left = 86.5054 +margin_top = 144.902 +margin_right = 179.505 +margin_bottom = 181.902 +text = "play again" + +[node name="ProgressBar" type="ProgressBar" parent="."] +margin_left = 410.651 +margin_top = 560.551 +margin_right = 614.651 +margin_bottom = 582.551 +step = 1.0 +value = 100.0 +[connection signal="pressed" from="Popup/Button" to="." method="_on_Button_pressed"]