remove wall sound

This commit is contained in:
Adrien MALINGREY 2024-10-21 08:57:13 +02:00
parent 7faae294dc
commit bd5c7dad3b

View File

@ -5,7 +5,7 @@ let holdQueue = new HoldQueue()
let matrix = new Matrix() let matrix = new Matrix()
let nextQueue = new NextQueue() let nextQueue = new NextQueue()
let playing = false let playing = false
let lastActionSucceded = true //let lastActionSucceded = true
let favicon let favicon
window.onload = function(event) { window.onload = function(event) {
@ -98,7 +98,7 @@ function ticktack() {
function generate(piece) { function generate(piece) {
matrix.piece = piece || nextQueue.shift() matrix.piece = piece || nextQueue.shift()
if (!piece && holdQueue.piece) holdQueue.drawPiece() if (!piece && holdQueue.piece) holdQueue.drawPiece()
lastActionSucceded = true //lastActionSucceded = true
favicon.href = matrix.piece.favicon_href favicon.href = matrix.piece.favicon_href
if (matrix.piece.canMove(TRANSLATION.NONE)) { if (matrix.piece.canMove(TRANSLATION.NONE)) {
@ -160,12 +160,13 @@ function onkeydown(event) {
if (!pressedKeys.has(event.key)) { if (!pressedKeys.has(event.key)) {
pressedKeys.add(event.key) pressedKeys.add(event.key)
action = settings.keyBind[event.key] action = settings.keyBind[event.key]
if (action()) { /*if (action()) {
lastActionSucceded = true lastActionSucceded = true
} else if (lastActionSucceded || !(action in REPEATABLE_ACTIONS)) { } else if (lastActionSucceded || !(action in REPEATABLE_ACTIONS)) {
playSound(wallSound) playSound(wallSound)
lastActionSucceded = false lastActionSucceded = false
} }*/
action()
if (REPEATABLE_ACTIONS.includes(action)) { if (REPEATABLE_ACTIONS.includes(action)) {
actionsQueue.unshift(action) actionsQueue.unshift(action)
scheduler.clearTimeout(repeat) scheduler.clearTimeout(repeat)
@ -187,12 +188,13 @@ function repeat() {
function autorepeat() { function autorepeat() {
if (actionsQueue.length) { if (actionsQueue.length) {
if (actionsQueue[0]()) { /*if (actionsQueue[0]()) {
lastActionSucceded = true lastActionSucceded = true
} else if (lastActionSucceded) { } else if (lastActionSucceded) {
wallSound.play() wallSound.play()
lastActionSucceded = false lastActionSucceded = false
} }*/
actionsQueue[0]()
} }
else scheduler.clearInterval(autorepeat) else scheduler.clearInterval(autorepeat)
} }