Hello!
I'm working on a 2D platformer, and have my character's footstep sounds synced to his animation. Currently, I'm using two AudioStreamPlayers, one to play the left footstep, one to play the right.
On long stretches of just walking, it sounds repetitive and mechanical, so I'm trying to add variety. Instead of each AudioStreamPlayer always playing the same sample, I want to script one AudioStreamPlayer to randomly select from a list of "left foot" samples, and the other AudioStreamPlayer to select from a list of "right foot" samples.
So I've pulled apart a recording of 30-ish footsteps, separated them into folders, and started scripting.
The issue I'm having is that I don't understand the syntax of how I'm supposed to code this. Here's my first try, just trying to select a specific file (not doing the random selection yet). This is in one AudioStreamPlayer's _process(delta):
self.stream = res://Sounds/Indexed_Footsteps/Left/Footstep_L01.ogg
It gives an error:
Expected end of statement after expression, got ":" instead
Anybody have any idea if this property (stream) is scriptable, and if so, how? I've looked at the docs, which do indeed cover definitions of everything, but I think I'm missing some basic understanding of how to interpret the docs, so examples of the functions and properties in actual use are very helpful to me. So far, I can't find any examples of what I'm lookiung to do.
Thanks in advance for any insight you may have!
-Mark