extends AnimationPlayer
var audio_stream: AudioStream
func _ready():
audio_stream = load("res://EL SONIDO/RUJEScorto.ogg")
var audio_player = AudioStreamPlayer.new()
audio_player.stream = audio_stream
add_child(audio_player)
#func _on_AnimationPlayer_input_event(event):
func _input(event):
if event is InputEventMouseButton:
if event.button_index == 1:
$AudioStreamPlayer3D.play()
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
En el script de devajo al soltar la pulsacion se detiene el sonido , el script inferior es correcto....
---------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------
extends AnimationPlayer
var audio_stream: AudioStream
func _ready():
audio_stream = load("res://EL SONIDO/RUJEScorto.ogg")
var audio_player = AudioStreamPlayer.new()
audio_player.stream = audio_stream
add_child(audio_player)
func _input(event):
if event is InputEventMouseButton:
if event.button_index == 1: # Botón izquierdo del mouse
if event.pressed:
$AudioStreamPlayer3D.play() # Reproduce el sonido al presionar
else:
$AudioStreamPlayer3D.stop() # Detiene el sonido al soltar
No hay comentarios:
Publicar un comentario