From 6b3fc2e00e8e8ec51f2e9751bdce4414df074689 Mon Sep 17 00:00:00 2001 From: Matt Jenkins Date: Tue, 14 May 2024 12:28:05 +0100 Subject: [PATCH] Improved volume slider values --- GameOver.tscn | 14 +++++++------- Intro.tscn | 14 +++++++------- Settings.gd | 12 +++++++----- Settings.tscn | 16 +++++++++------- project.godot | 2 +- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/GameOver.tscn b/GameOver.tscn index bca35a2..780ed47 100644 --- a/GameOver.tscn +++ b/GameOver.tscn @@ -9,16 +9,16 @@ [ext_resource type="Script" path="res://ScrollText.gd" id="6_y6ajf"] [ext_resource type="Texture2D" uid="uid://c6nwmsoi1gjvv" path="res://FadeTex.png" id="7_wpqjt"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_u467p"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_31xkm"] shader = ExtResource("3_u76hk") -shader_parameter/rect_global_position = Vector2(0, 0.0998668) -shader_parameter/rect_size = Vector2(640, 25) +shader_parameter/rect_global_position = Vector2(0, 0) +shader_parameter/rect_size = Vector2(160, 25) shader_parameter/ColourTexture = ExtResource("4_lxs2b") [sub_resource type="ShaderMaterial" id="ShaderMaterial_fxm16"] shader = ExtResource("6_t71ub") -shader_parameter/rect_global_position = Vector2(nan, nan) -shader_parameter/rect_size = Vector2(nan, nan) +shader_parameter/rect_global_position = Vector2(0, 0) +shader_parameter/rect_size = Vector2(0, 0) shader_parameter/ColourTexture = ExtResource("7_wpqjt") [node name="GameOver" type="Node2D"] @@ -35,7 +35,7 @@ size_flags_vertical = 3 theme = ExtResource("3_km2fx") [node name="GameOver" type="Label" parent="VBoxContainer"] -material = SubResource("ShaderMaterial_u467p") +material = SubResource("ShaderMaterial_31xkm") layout_mode = 2 theme = ExtResource("3_km2fx") theme_type_variation = &"Arkanoid" @@ -98,7 +98,7 @@ script = ExtResource("6_y6ajf") disable_3d = true transparent_bg = true handle_input_locally = false -size = Vector2i(211, 71) +size = Vector2i(2, 2) render_target_update_mode = 4 [node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/HBoxContainer2/SubViewportContainer/SubViewport"] diff --git a/Intro.tscn b/Intro.tscn index 6ab7c5d..8bc527f 100644 --- a/Intro.tscn +++ b/Intro.tscn @@ -23,21 +23,21 @@ point_count = 2 [sub_resource type="Gradient" id="Gradient_431mb"] colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1) -[sub_resource type="ShaderMaterial" id="ShaderMaterial_2oo2w"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_24rds"] shader = ExtResource("3_eo4f3") -shader_parameter/rect_global_position = Vector2(0.19822, 0.0732357) +shader_parameter/rect_global_position = Vector2(122.5, 27.5) shader_parameter/rect_size = Vector2(150, 25) shader_parameter/ColourTexture = ExtResource("4_v8i0c") -[sub_resource type="ShaderMaterial" id="ShaderMaterial_fb3e4"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_jnx1u"] shader = ExtResource("3_eo4f3") -shader_parameter/rect_global_position = Vector2(0.161003, 0.111851) +shader_parameter/rect_global_position = Vector2(99.5, 42) shader_parameter/rect_size = Vector2(242, 25) shader_parameter/ColourTexture = ExtResource("4_v8i0c") [sub_resource type="ShaderMaterial" id="ShaderMaterial_s1jgx"] shader = ExtResource("11_p7bee") -shader_parameter/rect_global_position = Vector2(0.332524, 0.210386) +shader_parameter/rect_global_position = Vector2(205.5, 79) shader_parameter/rect_size = Vector2(2.369, 3.688) shader_parameter/ColourTexture = ExtResource("12_8ixec") @@ -79,7 +79,7 @@ size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") [node name="ArkaLabel" type="Label" parent="VBoxContainer/HBoxContainer"] -material = SubResource("ShaderMaterial_2oo2w") +material = SubResource("ShaderMaterial_24rds") layout_mode = 2 theme = ExtResource("3_8d2ix") theme_type_variation = &"Arkanoid" @@ -100,7 +100,7 @@ size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") [node name="Revenge" type="Label" parent="VBoxContainer/HBoxContainer2"] -material = SubResource("ShaderMaterial_fb3e4") +material = SubResource("ShaderMaterial_jnx1u") layout_mode = 2 theme = ExtResource("3_8d2ix") theme_type_variation = &"Arkanoid" diff --git a/Settings.gd b/Settings.gd index c88b2db..900bc26 100644 --- a/Settings.gd +++ b/Settings.gd @@ -12,18 +12,16 @@ func _ready() -> void: ToggleNode.button_pressed = Global.relative_mouse AbsoluteNode.theme_type_variation = "" if Global.relative_mouse else "GlowLabel" RelativeNode.theme_type_variation = "GlowLabel" if Global.relative_mouse else "" - MusicNode.set_value_no_signal(Global.music_volume) - EffectsNode.set_value_no_signal(Global.effects_volume) + MusicNode.set_value_no_signal(db_to_linear(Global.music_volume)) + EffectsNode.set_value_no_signal(db_to_linear(Global.effects_volume)) func _on_exit_pressed() -> void: get_tree().change_scene_to_file("res://Intro.tscn") -func _on_music_volume_drag_ended(value_changed: bool) -> void: - Global.music_volume = MusicNode.value func _on_effects_volume_drag_ended(value_changed: bool) -> void: - Global.effects_volume = EffectsNode.value + Global.effects_volume = linear_to_db(EffectsNode.value) $Boink.play() @@ -48,3 +46,7 @@ func _on_relative_pressed() -> void: ToggleNode.button_pressed = true AbsoluteNode.theme_type_variation = "" if Global.relative_mouse else "GlowLabel" RelativeNode.theme_type_variation = "GlowLabel" if Global.relative_mouse else "" + + +func _on_music_value_changed(value: float) -> void: + Global.music_volume = linear_to_db(MusicNode.value) diff --git a/Settings.tscn b/Settings.tscn index 5ced509..315dc6d 100644 --- a/Settings.tscn +++ b/Settings.tscn @@ -97,9 +97,10 @@ vertical_alignment = 1 [node name="Music" type="HSlider" parent="VBoxContainer/HBoxContainer/RightPanel"] layout_mode = 2 -min_value = -80.0 -max_value = 0.0 -tick_count = 10 +max_value = 1.0 +step = 0.1 +tick_count = 11 +ticks_on_borders = true [node name="VSeparator2" type="VSeparator" parent="VBoxContainer/HBoxContainer/RightPanel"] custom_minimum_size = Vector2(0, 8) @@ -115,9 +116,10 @@ vertical_alignment = 1 [node name="Effects" type="HSlider" parent="VBoxContainer/HBoxContainer/RightPanel"] layout_mode = 2 -min_value = -80.0 -max_value = 0.0 -tick_count = 10 +max_value = 1.0 +step = 0.1 +tick_count = 11 +ticks_on_borders = true [node name="RightGutter" type="HSeparator" parent="VBoxContainer/HBoxContainer"] layout_mode = 2 @@ -150,7 +152,7 @@ bus = &"Effects" [connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/HBoxContainer/Absolute" to="." method="_on_absolute_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/HBoxContainer/Toggle" to="." method="_on_toggle_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/HBoxContainer/Relative" to="." method="_on_relative_pressed"] -[connection signal="drag_ended" from="VBoxContainer/HBoxContainer/RightPanel/Music" to="." method="_on_music_volume_drag_ended"] +[connection signal="value_changed" from="VBoxContainer/HBoxContainer/RightPanel/Music" to="." method="_on_music_value_changed"] [connection signal="drag_ended" from="VBoxContainer/HBoxContainer/RightPanel/Effects" to="." method="_on_effects_volume_drag_ended"] [connection signal="pressed" from="VBoxContainer/HBoxContainer2/ResetTimes" to="." method="_on_reset_times_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer2/Exit" to="." method="_on_exit_pressed"] diff --git a/project.godot b/project.godot index a91f0a0..c6f28ab 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="Dunkanoid" -config/version="1.0.3" +config/version="1.0.4" run/main_scene="res://Intro.tscn" config/features=PackedStringArray("4.2", "Forward Plus") run/max_fps=30