https://codepen.io/pelko/pen/jOpBmPN
Here's the full code.
This is the code to increase the size of snake once it collides with food.
The code above it and below it, sound play when food is eaten and changing food location when food is eaten are working(sound play won't work on codepen).
What's the problem. Please help to fix the issue and understand it as well.
Here's the full code.
JavaScript:
snakeArr.unshift({ x: snakeArr[0].x + inputDir.x, y: snakeArr[0].y + inputDir.y })
The code above it and below it, sound play when food is eaten and changing food location when food is eaten are working(sound play won't work on codepen).
What's the problem. Please help to fix the issue and understand it as well.