Added sounds to titlescreen

This commit is contained in:
2020-04-18 19:30:43 +02:00
parent c461869511
commit f3192c9b30
8 changed files with 74 additions and 10 deletions

Binary file not shown.

View File

@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/menu_focus_change.ogg-b255a32b3968213712292d0ecbc5df1e.oggstr"
[deps]
source_file="res://Menus/Sounds/menu_focus_change.ogg"
dest_files=[ "res://.import/menu_focus_change.ogg-b255a32b3968213712292d0ecbc5df1e.oggstr" ]
[params]
loop=false
loop_offset=0

Binary file not shown.

View File

@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/menu_option_select.ogg-f8ab7921ff48f27e306fb00e7fdd9726.oggstr"
[deps]
source_file="res://Menus/Sounds/menu_option_select.ogg"
dest_files=[ "res://.import/menu_option_select.ogg-f8ab7921ff48f27e306fb00e7fdd9726.oggstr" ]
[params]
loop=false
loop_offset=0

View File

@@ -8,5 +8,6 @@ func _ready():
animation_player.play("__INIT__")
func _on_Startup_startup_finished():
new_game_button.ignore_once = true # Pauls russian solution for ignoring the first sound click in the titlescreen
new_game_button.grab_focus()
animation_player.play("show_buttons")

View File

@@ -160,20 +160,23 @@ anchor_left = -0.00168862
anchor_top = -0.003002
anchor_right = 0.998311
anchor_bottom = 0.996998
margin_left = 0.875977
margin_right = 0.875977
margin_left = 0.810538
margin_top = -0.18946
margin_right = -141.189
margin_bottom = -89.1895
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Startup" parent="." instance=ExtResource( 2 )]
scale = Vector2( 1.50376, 1.50079 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.623951
anchor_top = 0.056
anchor_right = 0.970827
anchor_bottom = 0.469669
anchor_left = 0.619068
anchor_top = 1.05219
anchor_right = 0.965944
anchor_bottom = 1.46586
margin_left = 1.52588e-05
__meta__ = {
"_edit_group_": true,
@@ -181,7 +184,7 @@ __meta__ = {
}
[node name="NewGameButton" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_right = 166.0
margin_right = 117.0
scene_to_load = "res://World.tscn"
[node name="Label" parent="VBoxContainer/NewGameButton" index="0"]
@@ -189,7 +192,7 @@ text = "New Game"
[node name="CreditsButton" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 24.0
margin_right = 166.0
margin_right = 117.0
margin_bottom = 44.0
scene_to_load = "res://Menus/Credits/Credits.tscn"
@@ -198,7 +201,7 @@ text = "Credits"
[node name="QuitButton" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 48.0
margin_right = 166.0
margin_right = 117.0
margin_bottom = 68.0
quit = true

View File

@@ -3,10 +3,27 @@ class_name TitleSceenButton
export(String, FILE, "*.tscn,*.scn") var scene_to_load = ""
export(bool) var quit = false
onready var sound_focus = $Sounds/FocusChange
onready var sound_select = $Sounds/OptionSelect
var ignore_once = false
func _pressed():
sound_select.play()
func _on_OptionSelect_finished():
if quit:
get_tree().quit()
return
get_tree().change_scene(scene_to_load)
func _on_TitleScreenButton_mouse_entered():
grab_focus()
func _on_TitleScreenButton_focus_entered():
if not ignore_once:
sound_focus.play()
ignore_once = false

View File

@@ -1,7 +1,9 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Fonts/Harmonic/Harmonic24.tres" type="DynamicFont" id=1]
[ext_resource path="res://Menus/TitleScreen/TitleScreenButton.gd" type="Script" id=2]
[ext_resource path="res://Menus/Sounds/menu_focus_change.ogg" type="AudioStream" id=3]
[ext_resource path="res://Menus/Sounds/menu_option_select.ogg" type="AudioStream" id=4]
[node name="TitleScreenButton" type="Button"]
margin_right = 110.0
@@ -19,3 +21,14 @@ __meta__ = {
"_edit_use_anchors_": false,
"_editor_description_": ""
}
[node name="Sounds" type="Node" parent="."]
[node name="FocusChange" type="AudioStreamPlayer" parent="Sounds"]
stream = ExtResource( 3 )
[node name="OptionSelect" type="AudioStreamPlayer" parent="Sounds"]
stream = ExtResource( 4 )
[connection signal="focus_entered" from="." to="." method="_on_TitleScreenButton_focus_entered"]
[connection signal="mouse_entered" from="." to="." method="_on_TitleScreenButton_mouse_entered"]
[connection signal="finished" from="Sounds/OptionSelect" to="." method="_on_OptionSelect_finished"]