Files
kurovadis/objects/ui/sound_button.gd
T
2025-06-22 23:22:32 -06:00

34 lines
704 B
GDScript
Executable File

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()