This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //below code to check answers and generate questions should probably be moved to the socket server side, instead of client side | |
| //check answer | |
| function checkAnswer(){ | |
| var msgCheck = newMsg.value.trim() | |
| var answerCheck = answer | |
| if (msgCheck.toLowerCase() == answerCheck.toLowerCase()) { | |
| console.log(userEmail + ' is the dawg now') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //runs when snake hits food to add length | |
| function eatFood() { | |
| //if food coordinates equal snake head coordinates, eat food and add length | |
| if(foodX === snakeHeadX && foodY === snakeHeadY) { | |
| score++ | |
| foodSound() | |
| //increases speed every 5 points | |
| speedIncrease() | |
| var length = snake.length |