Skip to content

Commit

Permalink
✨ feat: 테트리스 카운트 다운 css 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
wldnjs7064 committed Apr 29, 2024
1 parent a69bbc8 commit 27c7435
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions js/tetris.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ function updateGameContent() {
Pause
</button>
</div>
<div id="count-down">1</div>
<div id="count-down" class="count-down hide">
<p id="count-number">0</p>
</div>
</div>
<div id="game-controls" class="game-controls hide">
<button id="resumeButton" class="control-button" onclick="resumeGame()">
Expand Down
8 changes: 6 additions & 2 deletions js/tetris/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,12 +486,16 @@
let count = 10;
countdown = document.createElement("div"); // 전역 변수 countdown에 할당
countdown.id = "count-down";
countdown.textContent = count;
countdown.style.display = "block";

countdownInterval = setInterval(() => {
document.getElementById("count-number").textContent = count;
countdown.innerHTML = `
<p>CONTINUE?</p>
<p id="count-number">${count}</p>
<p>INSERT COIN</p>
`;
count--;
countdown.textContent = count;
if (count === 0) {
clearInterval(countdownInterval);
// 10초 카운트가 끝나면 아래 코드 실행
Expand Down

0 comments on commit 27c7435

Please sign in to comment.