0 votes

Hello guys
I was working on footsteps sound
But I got a problem when I stop, the sound does not stop with the player
Because of the time of the audio effect is long
How can I solve this problem

this my script

if is_on_floor() and not foot.playing and dir.z and dir.x != 0 :
        foot. Play()

السلام عليكم
لدي مشكلة واجهتني في خطوات اللاعب
ثدرت أخليه يعمل لما أتحرك لكن أذا وقفت الصوت يكمل لين ما يخلص مقطع الصوت
فكيف أحل هذي المشكلة

Godot version 3.5
in Engine by (14 points)

did you try ?

if is_on_floor() and not foot.playing and dir.z and dir.x != 0 :
        foot. Play()

else:
       foot.stop()

or

 if dir.z and diz.x == 0:
      foot.stop()

frist code will not make the sound work at all

Second one
not make any differed

I saw youtuber put timer, but I don't know if this actually work
or his sound effect repeat because its short voice

I think you should attach function call on the running animation when the frame of hitting the ground should add the call and play the sfx there ,

Should work like that also for dust particle same idea

و بتوفيق

'or' was the answer
oh my god

if dir.z or dir.x !=0:
    if is_on_floor():
        if ! foot.playing:
            foot. Play()
else :
    foot. Stop()

"أشتغل لما قلت له "أو
أعتذر للجميع على الأزعاج

Make it answer to help another people

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.