diff --git a/_media/js/game.js b/_media/js/game.js index 8b5be20..3fdc4eb 100644 --- a/_media/js/game.js +++ b/_media/js/game.js @@ -7,15 +7,24 @@ const keyboardLayouts = { } const pageCredits = '\ -

Font F5.6 by\ +

Font F5.6 by\ DOT COLON\

\ + \ +

UI by\ + chota.css\ +

\ '; const pageStatistics = ''; +const words = [ + 'google', 'speed', 'design', 'forest', 'forever', 'love', + 'horizon', 'defect' +]; + // game variables -let gameWord = 'speed'.toUpperCase(); +let gameWord = words[Math.floor(Math.random() * words.length)].toUpperCase(); let gameAnswered = new Array(gameWord.length + 1).join('-'); let lives = 6; @@ -26,7 +35,7 @@ function generateKeyboard(layout) layout.split('').forEach(function(letter) { - keyboardHtmlStr = keyboardHtmlStr + ''; }) @@ -108,6 +117,10 @@ function showPage(element, pageName) window.onload = function() { generateKeyboard(keyboardLayouts['usQwertyKeyboard']); - + document.querySelector('#lives').innerHTML = 'Lives ' + lives; + console.log('Word:', gameWord.toLowerCase()); document.querySelector('#word').innerHTML = gameAnswered; + + // fix load empty word + // if (gameWord === 0) { document.location.reload(true); } }