Is the beginning of your sound effect quiet?
Looking at the code, I'd expect it to begin playing your sound effect, from the start infinitely until motion isn't happening anymore (motion != Vector2.ZERO
just btw ;) ), then play the sound clip all the way through.
Also as a side-note to @Lola's comment: you can get the current play position in an AudioStreamPlayer with get_playback_position()
and pass the result as an argument to play(from_position)
. This probably isn't necessary for your use case, but is still a good-to-know :).