Hey,
I wrote a little script for you to handle randomized sound effects within a move route.
add it to a new .js file in your js/plugins folder and activate it in the editor.
Code:function soundPool(a, b) {
// a = sound file name
// b = number of sounds
return a + Math.floor(Math.random() * (b+1));
};
To use:
Create copies or rename your sound files so they share the same name, ending in a different number, starting at zero.
So the files would be:
Raise0.ogg
Raise1.ogg
Raise2.ogg
But it needs to start at 0, and there can't be any gaps in numbering. (so no 1,2,4,6).
In your Set Movement Route, select the "script" option, and paste in:
AudioManager.playSe({name: soundPool('Raise', 2), volume: 100, pitch: 100, pan: 0})
Obviously you can set the file name, the number to count up to, volume, pitch and pan to whatever you like!
How it works:
The script is a little function I've arbitrarily called soundPool, in the example above you give it two arguments: 'Raise' (the sound 'family' name) and 2; the highest number you have in that pool of sounds.
Used inside the AudioManager.playSe functionality from the engine itself, it justs chooses a random file from that pool of Raise sounds from 0 to the max you set.
Alternatively / Additionally:
Code:function Pitchy(a, b) {
// a = base value
// b = range either side for random number
return a + Math.floor(Math.random() * (2*b+1) -b);
}
You can vary the pitch like this, input your base value and the number of variance you want on either side.
So in your setMovement you could have:
AudioManager.playSe({name: 'Raise0', volume: 100, pitch: Pitchy(100,2), pan: 0})
And this would use one sound, but every time it's played it'd be pitched within 2 of
100, (so it'd play at pitch 98,99,100,101 or 102).
You can use either or both at the same time, and they won't interfere with any other scripts, they're just additional tools you can use in your script calls.
Hope these help, your game looks nice!