softer failure sound for ui/learn
parent
0adb337a9d
commit
fa5428f137
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -39,10 +39,6 @@ module.exports = function(blueprint, opts) {
|
||||||
// cheat
|
// cheat
|
||||||
Mousetrap.bind(['shift+enter'], complete);
|
Mousetrap.bind(['shift+enter'], complete);
|
||||||
|
|
||||||
var failSoundOnce = function() {
|
|
||||||
sound.once('failure', opts.stage.key + '/' + blueprint.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
var assertData = function() {
|
var assertData = function() {
|
||||||
return {
|
return {
|
||||||
scenario: scenario,
|
scenario: scenario,
|
||||||
|
@ -53,7 +49,7 @@ module.exports = function(blueprint, opts) {
|
||||||
|
|
||||||
var detectFailure = function() {
|
var detectFailure = function() {
|
||||||
var failed = blueprint.failure && blueprint.failure(assertData());
|
var failed = blueprint.failure && blueprint.failure(assertData());
|
||||||
if (failed) failSoundOnce();
|
if (failed) sound.failure();
|
||||||
return failed;
|
return failed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,7 +66,7 @@ module.exports = function(blueprint, opts) {
|
||||||
vm.failed = true;
|
vm.failed = true;
|
||||||
ground.stop();
|
ground.stop();
|
||||||
ground.showCapture(move);
|
ground.showCapture(move);
|
||||||
failSoundOnce();
|
sound.failure();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,7 +77,7 @@ module.exports = function(blueprint, opts) {
|
||||||
else { // moving into check
|
else { // moving into check
|
||||||
vm.failed = true;
|
vm.failed = true;
|
||||||
ground.showCheckmate(chess);
|
ground.showCheckmate(chess);
|
||||||
failSoundOnce();
|
sound.failure();
|
||||||
return m.redraw();
|
return m.redraw();
|
||||||
}
|
}
|
||||||
var took = false,
|
var took = false,
|
||||||
|
|
|
@ -15,8 +15,7 @@ var make = function(file, volume) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
var sounds = {
|
|
||||||
move: make('standard/Move'),
|
move: make('standard/Move'),
|
||||||
take: make('sfx/Tournament3rd', 0.4),
|
take: make('sfx/Tournament3rd', 0.4),
|
||||||
levelStart: make('other/ping'),
|
levelStart: make('other/ping'),
|
||||||
|
@ -24,16 +23,5 @@ var sounds = {
|
||||||
stageStart: make('other/guitar'),
|
stageStart: make('other/guitar'),
|
||||||
// stageEnd: make('sfx/Tournament1st'),
|
// stageEnd: make('sfx/Tournament1st'),
|
||||||
stageEnd: make('other/gewonnen'),
|
stageEnd: make('other/gewonnen'),
|
||||||
failure: make('other/failure')
|
failure: make('other/no-go')
|
||||||
};
|
};
|
||||||
|
|
||||||
var onces = [];
|
|
||||||
sounds.once = function(sound, id) {
|
|
||||||
var key = id + '/' + sound;
|
|
||||||
if (onces.indexOf(key) === -1) {
|
|
||||||
sounds[sound]();
|
|
||||||
onces.push(key);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = sounds;
|
|
||||||
|
|
Loading…
Reference in New Issue