mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-26 12:41:40 +00:00
fix roll sound popping
This commit is contained in:
parent
0b69c27a4f
commit
5cc595bbe7
1 changed files with 3 additions and 8 deletions
|
|
@ -963,7 +963,7 @@ class Marble extends GameObject {
|
||||||
if (rollVolume > 1)
|
if (rollVolume > 1)
|
||||||
rollVolume = 1;
|
rollVolume = 1;
|
||||||
if (contactPct < 0.05)
|
if (contactPct < 0.05)
|
||||||
rollVolume = 0;
|
rollVolume = rollSound.volume / 5; // We decrease it slowly
|
||||||
|
|
||||||
var slipVolume = 0.0;
|
var slipVolume = 0.0;
|
||||||
if (slipAmount > 1e-4) {
|
if (slipAmount > 1e-4) {
|
||||||
|
|
@ -989,7 +989,7 @@ class Marble extends GameObject {
|
||||||
rollMegaSound.volume = 0;
|
rollMegaSound.volume = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
slipSound.volume = slipVolume;
|
slipVolume = 0;
|
||||||
|
|
||||||
if (rollSound.getEffect(Pitch) == null) {
|
if (rollSound.getEffect(Pitch) == null) {
|
||||||
rollSound.addEffect(new Pitch());
|
rollSound.addEffect(new Pitch());
|
||||||
|
|
@ -1001,13 +1001,8 @@ class Marble extends GameObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var pitch = Util.clamp(rollVel.length() / 15, 0, 1) * 0.75 + 0.75;
|
var pitch = Util.clamp(rollVel.length() / _maxRollVelocity, 0, 1) * 0.75 + 0.75;
|
||||||
|
|
||||||
// #if js
|
|
||||||
// // Apparently audio crashes the whole thing if pitch is less than 0.2
|
|
||||||
// if (pitch < 0.2)
|
|
||||||
// pitch = 0.2;
|
|
||||||
// #end
|
|
||||||
var rPitch = rollSound.getEffect(Pitch);
|
var rPitch = rollSound.getEffect(Pitch);
|
||||||
rPitch.value = pitch;
|
rPitch.value = pitch;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue