diff --git a/Games/NumberQuess6/index.html b/Games/NumberQuess6/index.html index 68aeca9..95684e4 100644 --- a/Games/NumberQuess6/index.html +++ b/Games/NumberQuess6/index.html @@ -10,6 +10,10 @@ Quess Number 1D6 +
+ +

Money: 0

+

Guess The Number!

diff --git a/Games/NumberQuess6/main.js b/Games/NumberQuess6/main.js index 1e12c66..f4da806 100644 --- a/Games/NumberQuess6/main.js +++ b/Games/NumberQuess6/main.js @@ -2,11 +2,31 @@ const dice = document.querySelector('#dice'); //img let answear = document.querySelector('#answear'); //text ans let number = document.querySelector('#num'); //num selec +let moneyDisplay = document.querySelector('#money'); +let money = 0; + +async function display(){ + moneyDisplay.innerHTML = money; +} + +async function nft(amount){ //! MONEY POPPING + let dabloons = document.createElement('h4'); + dabloons.classList.add('coins'); + dabloons.innerHTML = `+${amount}`; + document.body.append(dabloons); + money += amount; + display(); + setTimeout(() => { + dabloons.remove(); + }, 500); +} + async function correct(){ let won = document.createElement('h1'); won.classList.add('result', 'won'); won.innerHTML = `Correct!
+10 coins`; document.body.append(won); + nft(10); setTimeout(() => { won.remove(); }, 600); diff --git a/Games/NumberQuess6/style.css b/Games/NumberQuess6/style.css index 1733b58..9c44a91 100644 --- a/Games/NumberQuess6/style.css +++ b/Games/NumberQuess6/style.css @@ -28,7 +28,7 @@ body{ background: #555; } -img{ +#dice{ width: 100px; height: 100px; margin: 1.25rem; @@ -135,4 +135,47 @@ button{ .result{ font-size: 45px; } +} + +.cash{ + position: absolute; + left: 0; + top: 0; + background: #222222cc; + padding: .5rem; + border-radius: 0 0 1rem 0; + display: flex; + flex-direction: row; + justify-content: space-evenly; + align-items: center; +} + +.cash img{ + margin-right: .5rem; + aspect-ratio: 1/1; + object-fit: contain; +} + +.coins{ + position: absolute; + color: red; + z-index: 5; + user-select: none; + left: 135px; + top: 17px; + transform: translate(-50%, -50%); + animation: money .15s ease-in; +} + +@keyframes money{ + from{ + transform: translate(-50%, -50%); + opacity: 1; + top: 17px; + } + to{ + transform: translate(-50%, -50%); + opacity: 0; + top: -10px; + } } \ No newline at end of file diff --git a/Games/money.png b/Games/money.png new file mode 100644 index 0000000..d2d4a28 Binary files /dev/null and b/Games/money.png differ