#I added walking sounds but it constantly plays when I'm not walking here's the code please help

1 messages · Page 1 of 1 (latest)

past egret
#

Well, your code only checks if it is not playing, so there is no reason why it wouldn't repeat infinitely.

You'd need to add another condition. Like checking if it is on the floor and/or moving.

past egret
#

atm you check if it is playing. You just need to add more conditions to the "if" with the "and" keyword.

Example:
if !$footsteps_sound.playing and velocity.x != 0 and is_on_floor():

Here's the docs for the if keyword. Altho the use of "and" and other boolean keywords seems to be covered elsewhere.
https://docs.godotengine.org/en/4.3/tutorials/scripting/gdscript/gdscript_basics.html#if-else-elif