-
Notifications
You must be signed in to change notification settings - Fork 485
Add button hover sound effect #2885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f642144
2acda14
1981a37
92a036b
d301cef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| [remap] | ||
|
|
||
| importer="wav" | ||
| type="AudioStreamWAV" | ||
| uid="uid://b11jqkfbthwec" | ||
| path="res://.godot/imported/Hover.wav-d00dcf75edf30b73b4333a46a1b42156.sample" | ||
|
|
||
| [deps] | ||
|
|
||
| source_file="res://assets/first_party/sounds/ui/Hover.wav" | ||
| dest_files=["res://.godot/imported/Hover.wav-d00dcf75edf30b73b4333a46a1b42156.sample"] | ||
|
|
||
| [params] | ||
|
|
||
| force/8_bit=false | ||
| force/mono=false | ||
| force/max_rate=false | ||
| force/max_rate_hz=44100 | ||
| edit/trim=false | ||
| edit/normalize=false | ||
| edit/loop_mode=0 | ||
| edit/loop_begin=0 | ||
| edit/loop_end=-1 | ||
| compress/mode=2 |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert please |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,13 +13,18 @@ extends Node | |
| @onready var button_sfx_player: AudioStreamPlayer = %ButtonSFXPlayer | ||
| @onready var toggle_on_sfx_player: AudioStreamPlayer = %ToggleOnSFXPlayer | ||
| @onready var toggle_off_sfx_player: AudioStreamPlayer = %ToggleOffSFXPlayer | ||
| @onready var hover_sfx_player: AudioStreamPlayer = %HoverSFXPlayer | ||
|
|
||
|
|
||
| func _enter_tree() -> void: | ||
| get_tree().node_added.connect(_on_node_added) | ||
|
|
||
|
|
||
| func _on_node_added(node: Node) -> void: | ||
| if node is BaseButton: | ||
| _connect_once(node.mouse_entered, _on_button_hovered) | ||
|
Comment on lines
+24
to
+25
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tried navigating with the keyboard or a gamepad? I wonder if we should play the same sound for the |
||
| _connect_once(node.focus_entered, _on_button_hovered) | ||
|
|
||
| if node is CheckButton: | ||
| _connect_once(node.toggled, _on_toggle_pressed) | ||
| elif node is Button: | ||
|
|
@@ -35,11 +40,8 @@ func _connect_once(sig: Signal, callable: Callable) -> void: | |
| sig.connect(callable) | ||
|
|
||
|
|
||
| func _on_toggle_pressed(toggled_on: bool) -> void: | ||
| if toggled_on: | ||
| toggle_on_sfx_player.play() | ||
| else: | ||
| toggle_off_sfx_player.play() | ||
| func _on_button_hovered() -> void: | ||
| hover_sfx_player.play() | ||
|
|
||
|
|
||
| func _on_button_pressed() -> void: | ||
|
|
@@ -52,3 +54,10 @@ func _on_slider_value_changed(_value: float) -> void: | |
|
|
||
| func _on_tab_clicked(_tab: int) -> void: | ||
| button_sfx_player.play() | ||
|
|
||
|
|
||
| func _on_toggle_pressed(toggled_on: bool) -> void: | ||
| if toggled_on: | ||
| toggle_on_sfx_player.play() | ||
| else: | ||
| toggle_off_sfx_player.play() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two (different)
Hover.wavfiles, which one is the correct oen?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct file is sounds/ui/Hover.wav. The duplicate in scenes/ has been removed.