Theme: Vegan Friendly Foods
- User should see starting screen, with a message asking them to press anyway to get started.
- The screen contains
- Wins
- the current word,
- hyphens representing the length of the word
- number of guesses the user has remaining
- The letters that the user has already guessed
- When user strokes keyboard the game will
- Check to see if that letter has already been guessed
- If letter has been guessed don’t log letter and decrement number of guesses
- if letter hasn’t been selected
- check to see if letter is contained in selected word
- If letter is contained in word then show on screen where letter is shown (be careful of multiples)
- If letter isn’t contained in word then place letter on already guessed and decrement number of guesses by 1
- check to see if letter is contained in selected word
- User wins when all hyphens are filled in with letter.
- Check to see if that letter has already been guessed
un-seen Logic: Create an array that contains all letter in alphabet assign to var alphabet
Create an array that contains possible words and assign to var veganWordBank
Create var wins to keep count of wins Create an empty array and assign var guessedLetters
Create a global var for guesses remaining named guessesRemain
On page load, have computer pick a random number that is assigned to a word in veganWordBank. Random number will need to correspond to an index number. Assign to currentWord[i]
Create function to contain onkeyup event, that holds the letter pressed by user
Pass in currentWord[i]
Uses indexOf to see if that letter is contained in varGuessedLetters
If letter is not contained, pass
seen logic-
Use document.getElementById for wins
Current word:
- wrap each hyphen in a span