A simply memory game in which the user attempts to click all 9 pictures without clicking the same one twice. Once the client clicks a picture twice that game is over. The highscore is updated once it is beat.
if (lost === false) {
// update our temporary vars
//if lost is false, the image that was just clicked is not already in the clicked array
//we have to add it and give them a point
updatedClicked.push(clicked);
newCurrentScore += 1;
//setting the state
this.setState({ clickedIcons: updatedClicked })
this.setState({ currentscore: newCurrentScore });
//stops the highscore from continuing to acrue across multiple games
if(newCurrentScore > highscore && newHighScore<9){
newHighScore += 1;
this.setState({ highscore: newHighScore });}
// alerts user to win, resets score to play again
if( newCurrentScore === 9){
alert("You Won!")
updatedClicked =[];
newCurrentScore=0;
this.setState({ clickedIcons: updatedClicked })
this.setState({ currentscore: newCurrentScore });}
}
- Clone repository
- Run npm start
- Alexis Bounds
- Portfolio
- Github Profile
- LinkedIn Profile
This project is licensed under the MIT License - see the LICENSE.md file for details