Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End game #30

Merged
merged 2 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
added end-game box
  • Loading branch information
CharlieMallon committed Nov 21, 2022
commit c6f2769574e0247ad2b74c3079a441c46a7a49bd
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