Settings dans le menu
This commit is contained in:
parent
bce4618507
commit
d54d58c736
99
HUD.tscn
99
HUD.tscn
@ -1,9 +1,10 @@
|
|||||||
[gd_scene load_steps=10 format=2]
|
[gd_scene load_steps=11 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://SlapGauge.gd" type="Script" id=1]
|
[ext_resource path="res://SlapGauge.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Start.gd" type="Script" id=2]
|
[ext_resource path="res://Start.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://fonts/TorontoSubwayRegular.ttf" type="DynamicFontData" id=3]
|
[ext_resource path="res://fonts/TorontoSubwayRegular.ttf" type="DynamicFontData" id=3]
|
||||||
[ext_resource path="res://Audio/menumusic.ogg" type="AudioStream" id=4]
|
[ext_resource path="res://Audio/menumusic.ogg" type="AudioStream" id=4]
|
||||||
|
[ext_resource path="res://Options.gd" type="Script" id=5]
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=4]
|
[sub_resource type="DynamicFont" id=4]
|
||||||
size = 19
|
size = 19
|
||||||
@ -106,21 +107,20 @@ text = "Slap"
|
|||||||
[node name="MenuLayer" type="CanvasLayer" parent="."]
|
[node name="MenuLayer" type="CanvasLayer" parent="."]
|
||||||
layer = 2
|
layer = 2
|
||||||
|
|
||||||
[node name="Start" type="Control" parent="MenuLayer"]
|
[node name="Background" type="ColorRect" parent="MenuLayer"]
|
||||||
pause_mode = 2
|
|
||||||
visible = false
|
|
||||||
margin_right = 40.0
|
|
||||||
margin_bottom = 40.0
|
|
||||||
theme = SubResource( 8 )
|
|
||||||
script = ExtResource( 2 )
|
|
||||||
|
|
||||||
[node name="Background" type="ColorRect" parent="MenuLayer/Start"]
|
|
||||||
margin_left = -4.0
|
margin_left = -4.0
|
||||||
margin_top = -8.0
|
margin_top = -8.0
|
||||||
margin_right = 1927.0
|
margin_right = 1927.0
|
||||||
margin_bottom = 1085.0
|
margin_bottom = 1085.0
|
||||||
color = Color( 0.14902, 0.121569, 0.121569, 1 )
|
color = Color( 0.14902, 0.121569, 0.121569, 1 )
|
||||||
|
|
||||||
|
[node name="Start" type="Control" parent="MenuLayer"]
|
||||||
|
pause_mode = 2
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
theme = SubResource( 8 )
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="Title" type="Label" parent="MenuLayer/Start"]
|
[node name="Title" type="Label" parent="MenuLayer/Start"]
|
||||||
margin_left = 532.0
|
margin_left = 532.0
|
||||||
margin_top = 353.0
|
margin_top = 353.0
|
||||||
@ -153,7 +153,86 @@ text = "Quit Game"
|
|||||||
[node name="MenuMusic" type="AudioStreamPlayer" parent="MenuLayer/Start"]
|
[node name="MenuMusic" type="AudioStreamPlayer" parent="MenuLayer/Start"]
|
||||||
stream = ExtResource( 4 )
|
stream = ExtResource( 4 )
|
||||||
volume_db = 3.0
|
volume_db = 3.0
|
||||||
|
bus = "Music"
|
||||||
|
|
||||||
|
[node name="Options" type="Control" parent="MenuLayer/Start"]
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
theme = SubResource( 8 )
|
||||||
|
script = ExtResource( 5 )
|
||||||
|
|
||||||
|
[node name="MouseSensSlider" type="HSlider" parent="MenuLayer/Start/Options"]
|
||||||
|
margin_left = 1428.0
|
||||||
|
margin_top = 530.0
|
||||||
|
margin_right = 1755.0
|
||||||
|
margin_bottom = 562.0
|
||||||
|
rect_pivot_offset = Vector2( 199, 32 )
|
||||||
|
max_value = 0.5
|
||||||
|
step = 0.05
|
||||||
|
|
||||||
|
[node name="MousSensLbl" type="Label" parent="MenuLayer/Start/Options/MouseSensSlider"]
|
||||||
|
margin_left = -155.0
|
||||||
|
margin_top = 4.0
|
||||||
|
margin_right = -16.0
|
||||||
|
margin_bottom = 27.0
|
||||||
|
text = "Mouse Sensitivity"
|
||||||
|
|
||||||
|
[node name="SFXSlider" type="HSlider" parent="MenuLayer/Start/Options"]
|
||||||
|
margin_left = 1428.0
|
||||||
|
margin_top = 572.0
|
||||||
|
margin_right = 1755.0
|
||||||
|
margin_bottom = 604.0
|
||||||
|
rect_pivot_offset = Vector2( 199, 32 )
|
||||||
|
max_value = 1.0
|
||||||
|
step = 0.05
|
||||||
|
|
||||||
|
[node name="SFXSlider" type="Label" parent="MenuLayer/Start/Options/SFXSlider"]
|
||||||
|
margin_left = -117.0
|
||||||
|
margin_top = 5.0
|
||||||
|
margin_right = -18.0
|
||||||
|
margin_bottom = 27.0
|
||||||
|
text = "SFX Volume"
|
||||||
|
|
||||||
|
[node name="MusicSlider" type="HSlider" parent="MenuLayer/Start/Options"]
|
||||||
|
margin_left = 1428.0
|
||||||
|
margin_top = 612.0
|
||||||
|
margin_right = 1755.0
|
||||||
|
margin_bottom = 644.0
|
||||||
|
rect_pivot_offset = Vector2( -414, 50 )
|
||||||
|
max_value = 1.0
|
||||||
|
step = 0.05
|
||||||
|
|
||||||
|
[node name="MusicLbl" type="Label" parent="MenuLayer/Start/Options/MusicSlider"]
|
||||||
|
margin_left = -133.0
|
||||||
|
margin_top = 5.0
|
||||||
|
margin_right = -18.0
|
||||||
|
margin_bottom = 27.0
|
||||||
|
text = "Music Volume"
|
||||||
|
|
||||||
|
[node name="MasterVolSlider" type="HSlider" parent="MenuLayer/Start/Options"]
|
||||||
|
margin_left = 1428.0
|
||||||
|
margin_top = 654.0
|
||||||
|
margin_right = 1755.0
|
||||||
|
margin_bottom = 686.0
|
||||||
|
rect_pivot_offset = Vector2( -414, 50 )
|
||||||
|
max_value = 1.0
|
||||||
|
step = 0.05
|
||||||
|
|
||||||
|
[node name="MasterLbl" type="Label" parent="MenuLayer/Start/Options/MasterVolSlider"]
|
||||||
|
margin_left = -143.0
|
||||||
|
margin_top = 4.0
|
||||||
|
margin_right = -17.0
|
||||||
|
margin_bottom = 26.0
|
||||||
|
text = "Master Volume"
|
||||||
|
|
||||||
[connection signal="pressed" from="MenuLayer/Start/New Game" to="MenuLayer/Start" method="_on_New_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 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"]
|
[connection signal="pressed" from="MenuLayer/Start/Quit Game" to="MenuLayer/Start" method="_on_Quit_Game_pressed"]
|
||||||
|
[connection signal="mouse_exited" from="MenuLayer/Start/Options/MouseSensSlider" to="MenuLayer/Start/Options" method="_on_MouseSensSlider_mouse_exited"]
|
||||||
|
[connection signal="value_changed" from="MenuLayer/Start/Options/MouseSensSlider" to="MenuLayer/Start/Options" method="_on_MouseSensSlider_value_changed"]
|
||||||
|
[connection signal="mouse_exited" from="MenuLayer/Start/Options/SFXSlider" to="MenuLayer/Start/Options" method="_on_SFXSlider_mouse_exited"]
|
||||||
|
[connection signal="value_changed" from="MenuLayer/Start/Options/SFXSlider" to="MenuLayer/Start/Options" method="_on_SFXSlider_value_changed"]
|
||||||
|
[connection signal="mouse_exited" from="MenuLayer/Start/Options/MusicSlider" to="MenuLayer/Start/Options" method="_on_MusicSlider_mouse_exited"]
|
||||||
|
[connection signal="value_changed" from="MenuLayer/Start/Options/MusicSlider" to="MenuLayer/Start/Options" method="_on_MusicSlider_value_changed"]
|
||||||
|
[connection signal="mouse_exited" from="MenuLayer/Start/Options/MasterVolSlider" to="MenuLayer/Start/Options" method="_on_MasterVolSlider_mouse_exited"]
|
||||||
|
[connection signal="value_changed" from="MenuLayer/Start/Options/MasterVolSlider" to="MenuLayer/Start/Options" method="_on_MasterVolSlider_value_changed"]
|
||||||
|
60
Options.gd
Normal file
60
Options.gd
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
onready var MouseSensSlider = $MouseSensSlider
|
||||||
|
onready var SFXVol = $SFXSlider
|
||||||
|
onready var MusicVol = $MusicSlider
|
||||||
|
onready var MasterVol = $MasterVolSlider
|
||||||
|
|
||||||
|
|
||||||
|
onready var SFXBusName := "SFX"
|
||||||
|
onready var MusicBusName := "Music"
|
||||||
|
onready var MasterBusName := "Master"
|
||||||
|
|
||||||
|
onready var SFXBus := AudioServer.get_bus_index(SFXBusName)
|
||||||
|
onready var MusicBus := AudioServer.get_bus_index(MusicBusName)
|
||||||
|
onready var MasterBus := AudioServer.get_bus_index(MasterBusName)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
MouseSensSlider.value = get_node("/root/Spatial/Player").mouse_sensitivity
|
||||||
|
SFXVol.value = db2linear(AudioServer.get_bus_volume_db(SFXBus))
|
||||||
|
MusicVol.value = db2linear(AudioServer.get_bus_volume_db(MusicBus))
|
||||||
|
MasterVol.value = db2linear(AudioServer.get_bus_volume_db(MasterBus))
|
||||||
|
|
||||||
|
|
||||||
|
func _on_MouseSensSlider_value_changed(value):
|
||||||
|
get_node("/root/Spatial/Player").mouse_sensitivity = value
|
||||||
|
|
||||||
|
|
||||||
|
func _on_SFXSlider_value_changed(value):
|
||||||
|
AudioServer.set_bus_volume_db(SFXBus, linear2db(value))
|
||||||
|
|
||||||
|
|
||||||
|
func _on_MusicSlider_value_changed(value):
|
||||||
|
AudioServer.set_bus_volume_db(MusicBus, linear2db(value))
|
||||||
|
|
||||||
|
|
||||||
|
func _on_MasterVolSlider_value_changed(value):
|
||||||
|
AudioServer.set_bus_volume_db(MasterBus, linear2db(value))
|
||||||
|
|
||||||
|
|
||||||
|
func _on_MouseSensSlider_mouse_exited():
|
||||||
|
pass#MouseSensSlider.release_focus()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_SFXSlider_mouse_exited():
|
||||||
|
pass#SFXVol.release_focus()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_MusicSlider_mouse_exited():
|
||||||
|
pass#MusicVol.release_focus()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_MasterVolSlider_mouse_exited():
|
||||||
|
pass#MasterVol.release_focus()
|
13
Start.gd
13
Start.gd
@ -4,11 +4,11 @@ var ingame = false
|
|||||||
onready var NewGame = $"New Game"
|
onready var NewGame = $"New Game"
|
||||||
onready var QuitGame = $"Quit Game"
|
onready var QuitGame = $"Quit Game"
|
||||||
onready var QuitDesktop = $"Quit to Desktop"
|
onready var QuitDesktop = $"Quit to Desktop"
|
||||||
onready var Music = $"MenuMusic"
|
onready var MMusic = $"MenuMusic"
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
Music.play()
|
MMusic.play()
|
||||||
self.show()
|
get_parent().show()
|
||||||
get_tree().paused = true
|
get_tree().paused = true
|
||||||
QuitGame.hide()
|
QuitGame.hide()
|
||||||
QuitDesktop.margin_top -= 44
|
QuitDesktop.margin_top -= 44
|
||||||
@ -19,11 +19,11 @@ func _on_Quit_to_Desktop_Button_pressed():
|
|||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
|
||||||
func _on_New_Game_pressed():
|
func _on_New_Game_pressed():
|
||||||
self.hide()
|
get_parent().hide()
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||||
get_tree().paused = false
|
get_tree().paused = false
|
||||||
ingame = true
|
ingame = true
|
||||||
Music.stop()
|
MMusic.stop()
|
||||||
|
|
||||||
func openMenu():
|
func openMenu():
|
||||||
if (ingame):
|
if (ingame):
|
||||||
@ -33,9 +33,10 @@ func openMenu():
|
|||||||
QuitDesktop.margin_top = 664
|
QuitDesktop.margin_top = 664
|
||||||
QuitDesktop.margin_bottom = 708
|
QuitDesktop.margin_bottom = 708
|
||||||
|
|
||||||
self.show()
|
get_parent().show()
|
||||||
get_tree().paused = true
|
get_tree().paused = true
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||||
|
|
||||||
func _on_Quit_Game_pressed():
|
func _on_Quit_Game_pressed():
|
||||||
get_tree().reload_current_scene()
|
get_tree().reload_current_scene()
|
||||||
|
get_tree().paused = true
|
||||||
|
@ -22,7 +22,7 @@ bus/1/name = "SFX"
|
|||||||
bus/1/solo = false
|
bus/1/solo = false
|
||||||
bus/1/mute = false
|
bus/1/mute = false
|
||||||
bus/1/bypass_fx = false
|
bus/1/bypass_fx = false
|
||||||
bus/1/volume_db = 6.02
|
bus/1/volume_db = 0.0
|
||||||
bus/1/send = "Master"
|
bus/1/send = "Master"
|
||||||
bus/1/effect/0/effect = SubResource( 2 )
|
bus/1/effect/0/effect = SubResource( 2 )
|
||||||
bus/1/effect/0/enabled = false
|
bus/1/effect/0/enabled = false
|
||||||
@ -32,5 +32,5 @@ bus/2/name = "Music"
|
|||||||
bus/2/solo = false
|
bus/2/solo = false
|
||||||
bus/2/mute = false
|
bus/2/mute = false
|
||||||
bus/2/bypass_fx = false
|
bus/2/bypass_fx = false
|
||||||
bus/2/volume_db = -3.76831
|
bus/2/volume_db = 0.0
|
||||||
bus/2/send = "Master"
|
bus/2/send = "Master"
|
||||||
|
Loading…
Reference in New Issue
Block a user