add keyboard clicking sounds
This commit is contained in:
parent
0cd6bd6cd0
commit
832565d28a
4 changed files with 35 additions and 2 deletions
|
|
@ -1,11 +1,17 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://d0iltvfnuao1q"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://d0iltvfnuao1q"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cj0cg8u5mclxe" path="res://numpad_button.gd" id="1_orrea"]
|
||||
[ext_resource type="AudioStream" uid="uid://ctkxotof2clun" path="res://assets/numpad/audio/click.wav" id="2_hixh2"]
|
||||
|
||||
[node name="TextureButton" type="TextureButton"]
|
||||
[node name="TextureButton" type="TextureButton" node_paths=PackedStringArray("audio_player")]
|
||||
script = ExtResource("1_orrea")
|
||||
audio_player = NodePath("AudioStreamPlayer2D")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
region_enabled = true
|
||||
|
||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("2_hixh2")
|
||||
volume_db = 2.385
|
||||
|
||||
[connection signal="button_down" from="." to="." method="_on_button_down"]
|
||||
|
|
|
|||
BIN
assets/numpad/audio/click.wav
Normal file
BIN
assets/numpad/audio/click.wav
Normal file
Binary file not shown.
24
assets/numpad/audio/click.wav.import
Normal file
24
assets/numpad/audio/click.wav.import
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://ctkxotof2clun"
|
||||
path="res://.godot/imported/click.wav-4383acbd80dcc81771c497565ff896f2.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/numpad/audio/click.wav"
|
||||
dest_files=["res://.godot/imported/click.wav-4383acbd80dcc81771c497565ff896f2.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
|
||||
|
|
@ -3,6 +3,7 @@ extends TextureButton
|
|||
@export var button_value = 0
|
||||
@export var button_texture: Texture2D
|
||||
@export var button_region: Rect2
|
||||
@export var audio_player: AudioStreamPlayer2D
|
||||
|
||||
@onready var parent: Numpad = get_parent()
|
||||
|
||||
|
|
@ -12,6 +13,8 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func _on_button_down() -> void:
|
||||
audio_player.play()
|
||||
|
||||
if button_value <= 9:
|
||||
parent.keypad_entry(button_value)
|
||||
elif button_value == 10:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue