Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c2c0b2a
refactor: refatoração do codigo
Oct 6, 2026
a9d5a47
feat(pause): adcionando o modal
Oct 6, 2026
fd6541f
feat: adiciona diferentes temas visuais ao jogo
Fidelixjv Oct 8, 2026
a1f7fea
feat:adicionando tela de game-over
IanKilwiny Oct 8, 2026
57b8a44
adequando o tamanho dos botoes
Fidelixjv Oct 8, 2026
25b6adb
refactor:adicionando score e rows no popup
IanKilwiny Oct 8, 2026
720eb3b
ajustando cores dos botões
Fidelixjv Oct 8, 2026
41eefb8
adição de peças mk1
Rianx1601 Oct 8, 2026
109265a
feat: adiciona botao de reiniciar
ryanccoelho Oct 8, 2026
dc72ff0
implementa reinicio da partidae estiliza;ao do botao
ryanccoelho Oct 13, 2026
fdedf21
Merge main into feature/temas
Fidelixjv Oct 13, 2026
05c2220
feat(pause): styles e codigo do modal
JohnOnias Oct 13, 2026
c6133eb
merge: feature/pause
JohnOnias Oct 13, 2026
93f5871
atualização das corres das peças que estava bagunçado
Rianx1601 Oct 13, 2026
e09103c
romoção de uma peça block 4x4
Rianx1601 Oct 13, 2026
af2d4fe
merge: integra feature/reiniciar na main
ryanccoelho Oct 13, 2026
b850fda
Revert "merge: integra feature/reiniciar na main"
ryanccoelho Oct 13, 2026
7705573
Reapply "merge: integra feature/reiniciar na main"
ryanccoelho Oct 13, 2026
32404e8
feat: add conquistas
alexandrekawan7 Oct 14, 2026
0187871
Merge pull request #1 from Fidelixjv/feature/conquistas
alexandrekawan7 Oct 14, 2026
e1e3e61
merge:adicionar botao reinicar
ryanccoelho Oct 14, 2026
8ee647c
Merge remote-tracking branch 'origin/feature/temas' into testes
Fidelixjv Oct 14, 2026
ba42d1b
feat: adiciona sistema de áudio
pedrothiagos Oct 15, 2026
e0c382e
feat: integra áudio ao jogo
pedrothiagos Oct 15, 2026
82af7a7
feat: melhorar os contadores e o menu lateral
Bruno-adryelyson Oct 15, 2026
771ad78
Merge pull request #2 from Fidelixjv/feature/contador-linhasEliminadas
Bruno-adryelyson Oct 15, 2026
e4d65f6
Merge pull request #3 from Fidelixjv/testes
Bruno-adryelyson Oct 15, 2026
6769806
Merge pull request #4 from Fidelixjv/feature/game_play
Rianx1601 Oct 15, 2026
7c15547
Merge pull request #5 from Fidelixjv/feature/audio-jogo-correta
Rianx1601 Oct 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/pause.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 118 additions & 0 deletions audio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@


(function () {
let audioContext = null;
let muted = false;
let musicTimer = null;
let noteIndex = 0;

const melody = [
261.63, 329.63, 392.00, 329.63,
293.66, 349.23, 440.00, 349.23,
261.63, 329.63, 392.00, 523.25,
440.00, 392.00, 329.63, 293.66
];

function init() {
const AudioContextClass =
window.AudioContext || window.webkitAudioContext;

if (!audioContext && AudioContextClass) {
audioContext = new AudioContextClass();
}

if (audioContext && audioContext.state === "suspended") {
audioContext.resume();
}
}

function tone(frequency, duration, volume, type) {
if (muted || !audioContext) return;

const oscillator = audioContext.createOscillator();
const gain = audioContext.createGain();
const now = audioContext.currentTime;

oscillator.type = type || "square";
oscillator.frequency.setValueAtTime(frequency, now);

gain.gain.setValueAtTime(volume, now);
gain.gain.exponentialRampToValueAtTime(
0.001, now + duration
);

oscillator.connect(gain);
gain.connect(audioContext.destination);

oscillator.start(now);
oscillator.stop(now + duration);
}

function startMusic() {
init();

if (!audioContext || musicTimer) return;

musicTimer = setInterval(function () {
if (!muted) {
tone(melody[noteIndex], 0.18, 0.025, "triangle");
noteIndex = (noteIndex + 1) % melody.length;
}
}, 220);
}

function stopMusic() {
clearInterval(musicTimer);
musicTimer = null;
}

function move() {
init();
tone(440, 0.045, 0.04);
}

function rotate() {
init();
tone(660, 0.065, 0.04);
}

function lock() {
init();
tone(180, 0.10, 0.05);
}

function toggleMute() {
muted = !muted;

const button = document.getElementById("muteButton");

if (button) {
button.textContent = muted
? "🔇 Som desligado"
: "🔊 Som ligado";

button.setAttribute("aria-pressed", String(muted));
}

if (!muted) init();
}

function isMuted() {
return muted;
}

document.getElementById("muteButton")
?.addEventListener("click", function () {
init();
toggleMute();
});

window.TetrisAudio = {
startMusic,
stopMusic,
move,
rotate,
lock,
isMuted
};
})();
Loading