Skip to content

Commit

Permalink
✨ feat: 공룡 코인이 0개일때, 카운트다운 화면 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
wldnjs7064 committed Apr 28, 2024
1 parent 85bdaac commit aa27075
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 138 deletions.
22 changes: 12 additions & 10 deletions js/dinosaur/dinosaur.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
function loadGameDino() {
console.log(globalSelectedCharacter);
const content = document.getElementById('content');
const content = document.getElementById("content");

var newStyle = document.createElement('link');
newStyle.setAttribute('rel', 'stylesheet');
var newStyle = document.createElement("link");
newStyle.setAttribute("rel", "stylesheet");

resetAnimation(content);
updateGameContent();
}

function resetAnimation(element) {
element.classList.remove('fade-in');
element.classList.remove("fade-in");
void element.offsetWidth;
element.classList.add('fade-in');
element.classList.add("fade-in");
}

function pauseMusic(soundId) {
Expand All @@ -21,8 +21,8 @@ function pauseMusic(soundId) {
}

function updateGameContent() {
pauseMusic('mainBgm');
const content = document.getElementById('content');
pauseMusic("mainBgm");
const content = document.getElementById("content");
content.innerHTML = `
<link rel="stylesheet" href="css/dinosaur.css" />
<audio id="jumpSound" src="audios/dino/dino-jump.mp3"></audio>
Expand Down Expand Up @@ -101,9 +101,11 @@ function updateGameContent() {
</button>
</div>
</div>
<div id="count-down">1</div>
`;

loadScript('js/dinosaur/main.js');
loadScript("js/dinosaur/main.js");
}

function loadScript(src) {
Expand All @@ -112,9 +114,9 @@ function loadScript(src) {
existingScript.remove();
}

let script = document.createElement('script');
let script = document.createElement("script");
script.src = src;
script.type = 'text/javascript';
script.type = "text/javascript";
script.async = false;
document.body.appendChild(script);
}
Loading

0 comments on commit aa27075

Please sign in to comment.