Skip to content

Commit

Permalink
feat: add teacher
Browse files Browse the repository at this point in the history
  • Loading branch information
jackd248 committed Oct 5, 2024
1 parent f92e33c commit 84e8d85
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
Binary file added homework/math/assets/media/math-teacher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 16 additions & 2 deletions homework/math/assets/style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,22 @@ footer button {
}

#counter {
display: block;
display: none;
position: absolute;
bottom: 1em;
right: 1em;
font-size: .75em;
color: #666;
width: 40px;
text-align: right;
}

#counter img {
max-width: 100%;
}

#counter div {
margin-top: 1em;
}

#life {
Expand All @@ -88,7 +98,11 @@ footer button {

#bar {
margin-top: 5px;
font-size: 9px;
font-size: 6px;
}

#intro img {
max-width: 25%;
}

#highScore {
Expand Down
22 changes: 17 additions & 5 deletions homework/math/game.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
document.getElementById('calculationResult').style.color = '#666';
document.getElementById('resultInput').style.borderColor = '#666';
document.getElementById('resultInput').value = '';
document.getElementById('counter').innerText = counter;
document.getElementById('counter').querySelector('div').innerText = counter;


let calculation = '';
Expand Down Expand Up @@ -138,6 +138,10 @@
}

function changeLevel(newLevel) {
if (newLevel > 3) {
newLevel = 3;
}

level = newLevel;
document.getElementById(`level`).innerText = `Level ${level}`;
}
Expand Down Expand Up @@ -175,6 +179,8 @@
changeLevel(1);
document.getElementById('game').style.display = 'flex';
document.getElementById('start').style.display = 'none';
document.getElementById('intro').style.display = 'none';
document.getElementById('counter').style.display = 'block';
document.getElementById(`resultEmoji`).innerText = '';
document.getElementById(`resultTime`).innerText = '';
document.getElementById('highScore').innerHTML = '';
Expand All @@ -199,7 +205,7 @@
document.getElementById('resultTime').innerText = formattedTime;
document.getElementById(`level`).innerText = '';
document.getElementById(`bar`).innerText = '';
document.getElementById('counter').innerText = counter;
document.getElementById('counter').querySelector('div').innerText = counter;
displayHighScore();
}

Expand All @@ -216,7 +222,7 @@
document.getElementById('resultTime').innerText = formattedTime;
document.getElementById(`level`).innerText = '';
document.getElementById(`bar`).innerText = '';
document.getElementById('counter').innerText = counter;
document.getElementById('counter').querySelector('div').innerText = counter;
}

function formatElapsedTime(seconds) {
Expand Down Expand Up @@ -329,7 +335,10 @@
</div>
</div>
<div id="result">
<div id="resultEmoji">🧮</div>
<div id="intro">
<img src="assets/media/math-teacher.png" alt="Math Teacher" />
</div>
<div id="resultEmoji"></div>
<div id="resultTime">Math Game</div>
<div id="highScore"></div>
</div>
Expand All @@ -339,7 +348,10 @@
<button id="verifyResultButton" style="display: none;" onclick="verifyResult()">✅ Submit</button>
<button id="newCalculationButton" onclick="generateRandomCalculation()" style="display: none;">🆕 Next</button>
<div id="life"></div>
<div id="counter"></div>
<div id="counter">
<img src="assets/media/math-teacher.png" alt="Math Teacher" />
<div>0</div>
</div>
</footer>

<script type="text/javascript" src="assets/script/darkmode.js" async></script>
Expand Down

0 comments on commit 84e8d85

Please sign in to comment.