Addd sound when user click
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user