v0.8.1: limited sfx that play on sound slider, fixed minor slider error

This commit is contained in:
Evan Debenham 2020-05-24 23:10:33 -04:00
parent a9679057b3
commit f72b86df80
2 changed files with 13 additions and 4 deletions

View File

@ -108,7 +108,7 @@ public abstract class OptionSlider extends Component {
protected void onPointerDown( PointerEvent event ) { protected void onPointerDown( PointerEvent event ) {
pressed = true; pressed = true;
PointF p = camera().screenToCamera((int) event.current.x, (int) event.current.y); PointF p = camera().screenToCamera((int) event.current.x, (int) event.current.y);
sliderNode.x = GameMath.gate(sliderBG.x-2, p.x, sliderBG.x+sliderBG.width()-2); sliderNode.x = GameMath.gate(sliderBG.x-2, p.x - sliderNode.width()/2, sliderBG.x+sliderBG.width()-2);
sliderNode.brightness(1.5f); sliderNode.brightness(1.5f);
} }
@ -116,7 +116,7 @@ public abstract class OptionSlider extends Component {
protected void onPointerUp( PointerEvent event ) { protected void onPointerUp( PointerEvent event ) {
if (pressed) { if (pressed) {
PointF p = camera().screenToCamera((int) event.current.x, (int) event.current.y); PointF p = camera().screenToCamera((int) event.current.x, (int) event.current.y);
sliderNode.x = GameMath.gate(sliderBG.x - 2, p.x, sliderBG.x + sliderBG.width() - 2); sliderNode.x = GameMath.gate(sliderBG.x - 2, p.x - sliderNode.width()/2, sliderBG.x + sliderBG.width() - 2);
sliderNode.resetColor(); sliderNode.resetColor();
//sets the selected value //sets the selected value
@ -131,7 +131,7 @@ public abstract class OptionSlider extends Component {
protected void onDrag( PointerEvent event ) { protected void onDrag( PointerEvent event ) {
if (pressed) { if (pressed) {
PointF p = camera().screenToCamera((int) event.current.x, (int) event.current.y); PointF p = camera().screenToCamera((int) event.current.x, (int) event.current.y);
sliderNode.x = GameMath.gate(sliderBG.x - 2, p.x, sliderBG.x + sliderBG.width() - 2); sliderNode.x = GameMath.gate(sliderBG.x - 2, p.x - sliderNode.width()/2, sliderBG.x + sliderBG.width() - 2);
} }
} }
}; };

View File

@ -352,7 +352,16 @@ public class WndSettings extends WndTabbed {
@Override @Override
protected void onChange() { protected void onChange() {
SPDSettings.SFXVol(getSelectedValue()); SPDSettings.SFXVol(getSelectedValue());
Sample.INSTANCE.play(Random.element(Assets.Sounds.all)); if (Random.Int(100) == 0){
Sample.INSTANCE.play(Assets.Sounds.MIMIC);
} else {
Sample.INSTANCE.play(Random.oneOf(Assets.Sounds.GOLD,
Assets.Sounds.HIT,
Assets.Sounds.ITEM,
Assets.Sounds.SHATTER,
Assets.Sounds.EVOKE,
Assets.Sounds.TELEPORT));
}
} }
}; };
SFXVol.setSelectedValue(SPDSettings.SFXVol()); SFXVol.setSelectedValue(SPDSettings.SFXVol());