Skip to content

Commit

Permalink
added end-game box
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlieMallon committed Nov 21, 2022
1 parent ad55cdd commit c6f2769
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
23 changes: 23 additions & 0 deletions assets/css/game.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
height: 20%;
width: 80%;
border-radius: 10px;
color: #fafafa;
border: 4px dashed #fafafa;
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -33,6 +34,28 @@
flex-direction: row;
}

.end-game-container{
width: 80%;
border-radius: 10px;
border: 4px dashed #fafafa;
background-color: black;
position: absolute;
top: 40%;
left: 10%;
z-index: 10;
}

#end-game{
display: flex;
flex-direction: column;
align-items: center;
margin: 10px auto;
padding: 10px;
}

.playagain{
width: 160px;
}

/* game css */

Expand Down
8 changes: 6 additions & 2 deletions assets/js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const handleInput = (direction) => {

const startGame = () => {
const startTime = new Date().getTime()
const songLength = 30000 // 30sec
const songLength = 60000 // TODO this needs to be whatever the audio length is - get from Component


createRow();
Expand All @@ -153,7 +153,11 @@ const startGame = () => {
}

const gameEnd = () => {
console.log('pop up goes here')
document.getElementById('score-end').innerHTML = score;
document.getElementById('end-game').classList.remove('hidden')
if (score = 80){
document.getElementById('winner').classList.remove('hidden')
}
}

//end the level after song length
Expand Down
9 changes: 9 additions & 0 deletions game.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ <h3>Current Song</h3>
<div id="hit" class="hidden">HIT</div>
<div id="miss" class="hidden">MISS</div>
</div>
<!-- ./ScoreBoard -->
<div class="hidden end-game-container">
<div id="end-game">
<p>You scored</p>
<p>Score: <span id="score-end"></span></p>
<p id='winner' class="hidden">You are a Rhythm Hero</p>
<a class="btn btn-dark btn-lg playagain" href="carousel.html">Play Again?</a>
</div>
</div>
<!-- GameBoard -->
<div class="game-wrapper">
<div class="new-row-generator" id="new-row-generator">
Expand Down

0 comments on commit c6f2769

Please sign in to comment.