diff --git a/js/core.js b/js/core.js index 8e56db3..4d923c3 100644 --- a/js/core.js +++ b/js/core.js @@ -185,21 +185,22 @@ $.wait = function(callback, ms) { $.play = function(instrument, key, state) { var instrumentName = Object.keys(InstrumentEnum).find(k => InstrumentEnum[k] === instrument).toLowerCase(); var commonKey = KeyEnum[key]; + var tag = instrumentName + commonKey; var id = "#" + (instrument == InstrumentEnum.MEOW ? "mouth" : "paw-" + ((instrument == InstrumentEnum.BONGO ? commonKey : commonKey <= 5 && commonKey != 0 ? 0 : 1) == 0 ? "left" : "right")); if (state == true) { - if (jQuery.inArray(commonKey, pressed) !== -1) { + if (jQuery.inArray(tag, pressed) !== -1) { return; } - pressed.push(commonKey); + pressed.push(tag); if (instrument != InstrumentEnum.MEOW) { $(".instruments>div").each(function(index) { $(this).css("visibility", ($(this).attr("id") === instrumentName) ? "visible" : "hidden"); }); } - lowLag.play(instrumentName + commonKey); + lowLag.play(tag); $.layers(Object.keys(LayersPerInstrumentEnum).find(k => LayersPerInstrumentEnum[k] == instrument), true); } else { - pressed.remove(commonKey); + pressed.remove(tag); } $(id).css("background-position-x", (state ? "-800px" : "0")); }