Commit of existing data.
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
extends Button
|
||||
|
||||
@onready var audio_player: AudioStreamPlayer = $AudioPlayer
|
||||
|
||||
@export var FocusSound: AudioStream
|
||||
@export var PressSound: AudioStream
|
||||
|
||||
var flash: bool
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_pressed() -> void:
|
||||
if !PressSound:
|
||||
return
|
||||
audio_player.stream = PressSound
|
||||
audio_player.play()
|
||||
|
||||
|
||||
func _on_focus_entered() -> void:
|
||||
if !PressSound:
|
||||
return
|
||||
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
||||
return
|
||||
audio_player.stream = FocusSound
|
||||
audio_player.play()
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
uid://h6prwf5a5wwr
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bqlbo0yh111fw"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://h6prwf5a5wwr" path="res://objects/ui/sound_button.gd" id="1_f827h"]
|
||||
|
||||
[node name="SoundButton" type="Button"]
|
||||
script = ExtResource("1_f827h")
|
||||
|
||||
[node name="AudioPlayer" type="AudioStreamPlayer" parent="."]
|
||||
max_polyphony = 2
|
||||
bus = &"SFX"
|
||||
|
||||
[connection signal="focus_entered" from="." to="." method="_on_focus_entered"]
|
||||
[connection signal="pressed" from="." to="." method="_on_pressed"]
|
||||
Reference in New Issue
Block a user