add button sfx
This commit is contained in:
parent
26c2272c1b
commit
6de5a943f6
BIN
assets/sounds/button_down.wav
Normal file
BIN
assets/sounds/button_down.wav
Normal file
Binary file not shown.
21
assets/sounds/button_down.wav.import
Normal file
21
assets/sounds/button_down.wav.import
Normal file
|
@ -0,0 +1,21 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/button_down.wav-42814080afc0d5a0c8dc6a3e923f8da2.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sounds/button_down.wav"
|
||||
dest_files=[ "res://.import/button_down.wav-42814080afc0d5a0c8dc6a3e923f8da2.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=false
|
||||
compress/mode=0
|
BIN
assets/sounds/button_up.wav
Normal file
BIN
assets/sounds/button_up.wav
Normal file
Binary file not shown.
21
assets/sounds/button_up.wav.import
Normal file
21
assets/sounds/button_up.wav.import
Normal file
|
@ -0,0 +1,21 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/button_up.wav-ec2800f415eaeb69cc2da5cd45fee5fc.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sounds/button_up.wav"
|
||||
dest_files=[ "res://.import/button_up.wav-ec2800f415eaeb69cc2da5cd45fee5fc.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=false
|
||||
compress/mode=0
|
|
@ -92,6 +92,7 @@ func set_pressed(value: bool) -> void:
|
|||
#
|
||||
func _on_Button_button_down():
|
||||
button.rect_position.y = depth - _pressed_depth
|
||||
$AudioDown.play()
|
||||
emit_signal("button_down")
|
||||
|
||||
func _on_Button_button_up():
|
||||
|
@ -99,6 +100,7 @@ func _on_Button_button_up():
|
|||
button.rect_position.y = depth - _toggled_depth
|
||||
else:
|
||||
button.rect_position.y = 0
|
||||
$AudioUp.play()
|
||||
emit_signal("button_up")
|
||||
|
||||
func _on_Button_toggled(button_pressed):
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://assets/taqin_theme.tres" type="Theme" id=1]
|
||||
[ext_resource path="res://src/DepthButton.gd" type="Script" id=2]
|
||||
[ext_resource path="res://assets/sounds/button_down.wav" type="AudioStream" id=3]
|
||||
[ext_resource path="res://assets/sounds/button_up.wav" type="AudioStream" id=4]
|
||||
|
||||
[node name="DepthButton" type="Control"]
|
||||
anchor_right = 1.0
|
||||
|
@ -33,6 +35,12 @@ text = "Press Me"
|
|||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="AudioDown" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 3 )
|
||||
|
||||
[node name="AudioUp" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 4 )
|
||||
[connection signal="button_down" from="Button" to="." method="_on_Button_button_down"]
|
||||
[connection signal="button_up" from="Button" to="." method="_on_Button_button_up"]
|
||||
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]
|
||||
|
|
Loading…
Reference in a new issue