Addd sound when user click
This commit is contained in:
+19
-17
@@ -177,7 +177,7 @@ __meta__ = {
|
||||
[node name="PanelWood" type="Panel" parent="."]
|
||||
material = SubResource( 17 )
|
||||
margin_right = 350.0
|
||||
margin_bottom = 900.0
|
||||
margin_bottom = 720.0
|
||||
rect_min_size = Vector2( 350, 0 )
|
||||
size_flags_vertical = 3
|
||||
|
||||
@@ -194,15 +194,15 @@ __meta__ = {
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="PanelWood/VBoxContainer"]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 237.0
|
||||
margin_bottom = 147.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="TextureRect" type="TextureButton" parent="PanelWood/VBoxContainer/CenterContainer"]
|
||||
margin_left = 111.0
|
||||
margin_top = 54.0
|
||||
margin_top = 9.0
|
||||
margin_right = 239.0
|
||||
margin_bottom = 182.0
|
||||
margin_bottom = 137.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
@@ -212,9 +212,9 @@ texture_focused = ExtResource( 6 )
|
||||
stretch_mode = 3
|
||||
|
||||
[node name="ButtonPuzzle" type="TextureButton" parent="PanelWood/VBoxContainer"]
|
||||
margin_top = 267.0
|
||||
margin_top = 177.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 344.0
|
||||
margin_bottom = 254.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
@@ -241,9 +241,9 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="ButtonSetting" type="TextureButton" parent="PanelWood/VBoxContainer"]
|
||||
margin_top = 374.0
|
||||
margin_top = 284.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 451.0
|
||||
margin_bottom = 361.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
@@ -270,15 +270,15 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelWood/VBoxContainer"]
|
||||
margin_top = 481.0
|
||||
margin_top = 391.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 719.0
|
||||
margin_bottom = 539.0
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="ButtonQuit" type="TextureButton" parent="PanelWood/VBoxContainer"]
|
||||
margin_top = 749.0
|
||||
margin_top = 569.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 826.0
|
||||
margin_bottom = 646.0
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
@@ -304,23 +304,23 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="LabelVersion" type="Label" parent="PanelWood/VBoxContainer"]
|
||||
margin_top = 856.0
|
||||
margin_top = 676.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 870.0
|
||||
margin_bottom = 690.0
|
||||
size_flags_vertical = 0
|
||||
text = "v XX.XX"
|
||||
align = 2
|
||||
|
||||
[node name="MarginContainerBottom" type="MarginContainer" parent="PanelWood/VBoxContainer"]
|
||||
margin_top = 900.0
|
||||
margin_top = 720.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 900.0
|
||||
margin_bottom = 720.0
|
||||
size_flags_stretch_ratio = 0.2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
margin_left = 350.0
|
||||
margin_right = 446.0
|
||||
margin_bottom = 900.0
|
||||
margin_bottom = 720.0
|
||||
rect_clip_content = true
|
||||
size_flags_horizontal = 11
|
||||
size_flags_vertical = 3
|
||||
@@ -329,3 +329,5 @@ stretch_mode = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ClickButton" type="AudioStreamPlayer" parent="."]
|
||||
|
||||
@@ -64,25 +64,25 @@ margin_right = 153.0
|
||||
margin_bottom = 40.0
|
||||
align = 1
|
||||
|
||||
[node name="ambiant_sound" type="CenterContainer" parent="VBoxContainer"]
|
||||
[node name="ambient_sound" type="CenterContainer" parent="VBoxContainer"]
|
||||
margin_top = 62.0
|
||||
margin_right = 185.0
|
||||
margin_bottom = 102.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ambiant_sound"]
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ambient_sound"]
|
||||
margin_right = 185.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ambiant_sound/HBoxContainer"]
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ambient_sound/HBoxContainer"]
|
||||
margin_top = 13.0
|
||||
margin_right = 105.0
|
||||
margin_bottom = 27.0
|
||||
text = "Ambiant sound :"
|
||||
|
||||
[node name="data" type="CheckButton" parent="VBoxContainer/ambiant_sound/HBoxContainer"]
|
||||
[node name="data" type="CheckButton" parent="VBoxContainer/ambient_sound/HBoxContainer"]
|
||||
margin_left = 109.0
|
||||
margin_right = 185.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/gyroscope/HBoxContainer/data" to="." method="_on_gyroscope_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ambiant_sound/HBoxContainer/data" to="." method="_on_ambiant_sound_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ambient_sound/HBoxContainer/data" to="." method="_on_ambiant_sound_pressed"]
|
||||
|
||||
@@ -11,8 +11,8 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
margin_left = 385.0
|
||||
margin_top = 372.0
|
||||
margin_right = 1054.0
|
||||
margin_bottom = 528.0
|
||||
margin_left = 305.0
|
||||
margin_top = 282.0
|
||||
margin_right = 974.0
|
||||
margin_bottom = 438.0
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
@@ -4,11 +4,17 @@ export (PackedScene) var settings = load("res://scenes/UI/settings/Settings.tscn
|
||||
export (PackedScene) var scenes = load("res://scenes/UI/choose_scenes/ChooseScene.tscn")
|
||||
|
||||
onready var current_scene = "title"
|
||||
onready var stream_button= preload("res://assets/sounds/click-button.ogg")
|
||||
|
||||
func _ready():
|
||||
_translation()
|
||||
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer/TextureRect.grab_focus()
|
||||
_apply_scene("Title")
|
||||
_configure_sound()
|
||||
|
||||
func _configure_sound():
|
||||
stream_button.set_loop(false)
|
||||
$MarginContainer/HBoxContainer/UI_summary/ClickButton.stream = stream_button
|
||||
|
||||
## PRIVATE
|
||||
func _translation():
|
||||
@@ -28,16 +34,23 @@ func _apply_scene(actual_scene):
|
||||
|
||||
# Load scene for select game
|
||||
func _on_ButtonPuzzle_pressed():
|
||||
_sound_button()
|
||||
_apply_scene("ChooseScene")
|
||||
|
||||
# Load scene settings
|
||||
func _on_ButtonSetting_pressed():
|
||||
_sound_button()
|
||||
_apply_scene("Settings")
|
||||
|
||||
# Click to icon game
|
||||
func _on_TextureRect_pressed():
|
||||
_sound_button()
|
||||
_apply_scene("Title")
|
||||
|
||||
# Quit the game
|
||||
func _on_ButtonQuit_pressed():
|
||||
_sound_button()
|
||||
get_tree().quit(0)
|
||||
|
||||
func _sound_button():
|
||||
$MarginContainer/HBoxContainer/UI_summary/ClickButton.play()
|
||||
|
||||
@@ -92,43 +92,6 @@ margin_bottom = 720.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="PanelWood" parent="MarginContainer/HBoxContainer/UI_summary" index="0"]
|
||||
margin_bottom = 720.0
|
||||
|
||||
[node name="CenterContainer" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer" index="0"]
|
||||
margin_bottom = 147.0
|
||||
|
||||
[node name="TextureRect" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer" index="0"]
|
||||
margin_top = 9.0
|
||||
margin_bottom = 137.0
|
||||
|
||||
[node name="ButtonPuzzle" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer" index="1"]
|
||||
margin_top = 177.0
|
||||
margin_bottom = 254.0
|
||||
|
||||
[node name="ButtonSetting" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer" index="2"]
|
||||
margin_top = 284.0
|
||||
margin_bottom = 361.0
|
||||
|
||||
[node name="MarginContainer" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer" index="3"]
|
||||
margin_top = 391.0
|
||||
margin_bottom = 539.0
|
||||
|
||||
[node name="ButtonQuit" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer" index="4"]
|
||||
margin_top = 569.0
|
||||
margin_bottom = 646.0
|
||||
|
||||
[node name="LabelVersion" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer" index="5"]
|
||||
margin_top = 676.0
|
||||
margin_bottom = 690.0
|
||||
|
||||
[node name="MarginContainerBottom" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer" index="6"]
|
||||
margin_top = 720.0
|
||||
margin_bottom = 720.0
|
||||
|
||||
[node name="TextureRect" parent="MarginContainer/HBoxContainer/UI_summary" index="1"]
|
||||
margin_bottom = 720.0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer"]
|
||||
margin_left = 450.0
|
||||
margin_right = 1280.0
|
||||
|
||||
Reference in New Issue
Block a user