sei-ec-remote / project-1-issues

Open new issues here
1 stars 2 forks source link

audio #246

Closed RyanCLuis closed 11 months ago

RyanCLuis commented 11 months ago

What's the problem you're trying to solve?

so i added an eventlistener to add sound to my game, everything is working, but was wondering why im getting a error message .

Post any code you think might be relevant (one fenced block per file)

function renderBoard() {
    document.getElementById("mind-count").innerText = minds
    document.getElementById("head").addEventListener("click", setHead)
    setMinds()
    // populate my tiles using a for loop
    for (let r = 0;r < rows; r++) {
        let row = []
        for (let c = 0; c < columns; c++) {
            // making a div tag in HTML
            let tile = document.createElement("div")
            tile.id = `${r}-${c}`
            tile.addEventListener("click", tileClicked)
            // this is an event listener to play music on tile click
            tile.addEventListener("click", playMusic)
            document.getElementById("tiles").append(tile)
            row.push(tile)
        }
        board.push(row)
    }
}
function playMusic () {
    let audio = new Audio("soundEffects/gun.mp3")
    audio.play()
}

If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?

image

What is your best guess as to the source of the problem?

What things have you already tried to solve the problem?

Paste a link to your repository here

https://github.com/RyanCLuis/Minesweeper

timmshinbone commented 11 months ago

You can ignore that for now, if it's not breaking anything it should be fine

timmshinbone commented 11 months ago

If it's absolutely killin ya, try adding this to the head:

<link rel="shortcut icon" href="#">
RyanCLuis commented 11 months ago

ty @timmshinbone its not killing me, was just wondering why