add game end scene

This commit is contained in:
Alexander Popov 2021-02-25 09:13:37 +03:00
parent e881542c83
commit aaf6b69cc3
Signed by: iiiypuk
GPG Key ID: 398FC73478D97286
3 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,6 @@
## 2.0.2 # Build 2 [2021-02-25] ## 2.0.2 # Build 2 [2021-02-25]
- - Added game statistics - - Added game statistics
- - Added end game scene
- ✔️ - Fix keyboard fize on big screen - ✔️ - Fix keyboard fize on big screen
- ♻️ - JS code replace `var` by `let` - ♻️ - JS code replace `var` by `let`

View File

@ -1,5 +1,5 @@
[+] Keyboard fit
[ ] Game Statistics
[ ] Restart scene
[ ] Android manifest [ ] Android manifest
[+] Keyboard fit
[+] Game Statistics
[+] Restart scene
[+] iOS web app [+] iOS web app

View File

@ -67,9 +67,13 @@ function letterClick(letter)
if (gameAnswered.split('').indexOf('-') == -1) if (gameAnswered.split('').indexOf('-') == -1)
{ {
alert('You Win');
updateStats('stWinWords'); updateStats('stWinWords');
document.location.reload(true);
document.querySelector('#keyboard').innerHTML = '\
<img src="https://icongr.am/clarity/happy-face.svg?size=128&color=28bd14">\
<h1 class="text-success">Your winner!!</h1>\
<button class="button error" onclick="document.location.reload(true);"\
>Restart game</button>';
} }
} }
@ -78,9 +82,13 @@ function wrongLetter()
{ {
if (lives <= 0) if (lives <= 0)
{ {
alert('You dead');
updateStats('stTotalGames'); updateStats('stTotalGames');
document.location.reload(true);
document.querySelector('#keyboard').innerHTML = '\
<img src="https://icongr.am/clarity/sad-face.svg?size=128&color=d43939">\
<h1 class="text-error">Your lose!!</h1>\
<button class="button error" onclick="document.location.reload(true);"\
>Restart game</button>';
} }
lives -= 1; lives -= 1;