Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 7, 2019 03:57
Show Gist options
  • Save parzibyte/2f224fcbe9c48e2b6d8344cd4e30941c to your computer and use it in GitHub Desktop.
Save parzibyte/2f224fcbe9c48e2b6d8344cd4e30941c to your computer and use it in GitHub Desktop.

Revisions

  1. parzibyte created this gist Aug 7, 2019.
    27 changes: 27 additions & 0 deletions alertas.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    // Método que muestra la alerta indicando que el jugador ha perdido; después
    // de mostrarla, se reinicia el juego
    indicarFracaso() {
    Swal.fire({
    title: "Perdiste",
    html: `
    <img class="img-fluid" src="./img/perdiste.png" alt="Perdiste">
    <p class="h4">Agotaste tus intentos</p>`,
    confirmButtonText: "Jugar de nuevo",
    allowOutsideClick: false,
    allowEscapeKey: false,
    })
    .then(this.reiniciarJuego)
    },
    // Mostrar alerta de victoria y reiniciar juego
    indicarVictoria() {
    Swal.fire({
    title: "¡Ganaste!",
    html: `
    <img class="img-fluid" src="./img/ganaste.png" alt="Ganaste">
    <p class="h4">Muy bien hecho</p>`,
    confirmButtonText: "Jugar de nuevo",
    allowOutsideClick: false,
    allowEscapeKey: false,
    })
    .then(this.reiniciarJuego)
    },