Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommygebru/a6d879c4a05fb278adc1508922ea4a0c to your computer and use it in GitHub Desktop.
Save tommygebru/a6d879c4a05fb278adc1508922ea4a0c to your computer and use it in GitHub Desktop.
quick comments for unit 4 project - phrase hunter
class Phrase { constructor(phrase){ this.phrase = phrase.toLowerCase();
}//constructor
addPhraseToDisplay(){
///#phrase div with an inner ul element, no li elements yet
}//method
checkLetter(){
//checks to see if the letter selected by the player matches a letter in the phrase.
}//method
showMatchedLetter(){
//reveals the letter(s) on the board that matches the player's selection.
//To reveal the matching letter(s), select all of the letter DOM elements
//that have a CSS class name that matches the selected letter and replace
//each selected element's hide CSS class with the show CSS class.
}//method
}//class
class Game{
constructor(missed, phrases, activePhrase){
this.missed = missed
//this is a counter - initial value 0
this.phrases = //array of 5 phrase objects
this.activePhrase = active
}
startGame(){
//hides the start screen overlay
//calls getRandomPhrase method
//sets activephrase to the chosen phrase
//calls addPhraseToDisplay to add active/chosen phrase to the board
}//method
getRandomPhrase(){
//returns randomly chooses phrase
}//method
handleInteraction(){
//Disables the visual button indicator for the chosen letter
//A choice has been made!
//if wrong choice - add the "wrong" css class
//call removeLife() method
//if correct - add the "chosen" css class
//call showMatchedLetter() method
//call checkForWin() method
//if it returns true - call the gameOver() emthod
}//method
removeLife(){
//change liveHeart image to lostHeart
//++ to the missed property of the Game class!
//if missed = 5
//call gameOver() method
}//method
checkForWin(){
//if all letters from activePhrase property are chosen
//call gameOver() method
}//method
gameOver(){
//display the start screen
//add "win" or "lose" css classes, to the "start" css class
//update h1 DOM you lost - play again?
//update h1 DOM you won - play again!
}///method
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment