From 841eef8752acbc079b298d78460f967c579b9143 Mon Sep 17 00:00:00 2001 From: KubMakCZ Date: Wed, 12 Feb 2025 15:47:11 +0100 Subject: [PATCH] mod 17_minigame for bootstrap --- 17_minihra/game.js | 16 +++++------ 17_minihra/index.html | 62 ++++++++++++++++++++++++++++++++----------- 2 files changed, 54 insertions(+), 24 deletions(-) diff --git a/17_minihra/game.js b/17_minihra/game.js index 5fd1b46..08d3a96 100644 --- a/17_minihra/game.js +++ b/17_minihra/game.js @@ -34,18 +34,18 @@ function enemyAttack() { heroHp -= enemyDmg; document.getElementById("heroHp").innerText = heroHp; gameOver(); - battlelog("Zaútočil na tebe nepřítel"); + battlelog('
  • Zaútočil na tebe nepřítel
  • '); } else { heroDefense = false; document.getElementById("heroDefense").innerText = heroDefense; - battlelog("Vykryl jsi útok nepřítele") + battlelog('
  • Vykryl jsi útok nepřítele
  • ') } } function heal() { heroHp += hodkoustkou(10); document.getElementById("heroHp").innerText = heroHp; - battlelog("Vyléčil ses"); + battlelog('
  • Vyléčil ses
  • '); gameOver(); enemyAttack(); } @@ -53,7 +53,7 @@ function heal() { function attack() { enemyHp -= hodkoustkou(10); document.getElementById("enemyHp").innerText = enemyHp; - battlelog("Zaútočil jsi"); + battlelog('
  • Zaútočil jsi
  • '); gameOver(); enemyAttack(); } @@ -61,7 +61,7 @@ function attack() { function defense() { heroDefense = true; document.getElementById("heroDefense").innerText = heroDefense; - battlelog("Aktivoval si štít"); + battlelog('
  • Aktivoval si štít
  • '); } function luck(){ @@ -77,14 +77,14 @@ function luck(){ function gameOver() { console.log("Zjistuji stav-> Enemy:"+enemyHp+" Hero:"+heroHp); if (enemyHp <= 0) { - document.getElementById("game").innerHTML = "

    VYHRÁL JSI

    "; + document.getElementById("game").innerHTML = '
    VYHRÁL JSI
    '; } else if ( heroHp <= 0) { - document.getElementById("game").innerHTML = "

    PROHRÁL JSI

    " + document.getElementById("game").innerHTML = '
    PROHRÁL JSI
    '; } } function battlelog(text2log) { - document.getElementById("battlelog").innerHTML += text2log+ "
    "; + document.getElementById("battlelog").innerHTML += text2log; } diff --git a/17_minihra/index.html b/17_minihra/index.html index 79f8c6d..d8879bd 100644 --- a/17_minihra/index.html +++ b/17_minihra/index.html @@ -4,25 +4,55 @@ Document + - -

    Mini hra

    + +
    - - - - -
    Historie boje:
    +

    Simple Battle Page

    + + +
    +
    + +
    + Máš heroHp HP +
    +
    + +
    + Zaútoč se svou zbraní. Tvoje ÚČ je heroDmg +
    +
    + +
    + Ubraň se. heroDefense +
    +
    + + zkus své štěstí +
    +
    + + + +

    Historie boje:

    + +
    + + \ No newline at end of file