Click here to Skip to main content
15,867,937 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
https://codepen.io/pelko/pen/jOpBmPN

Here's the full code.

snakeArr.unshift({ x: snakeArr[0].x + inputDir.x, y: snakeArr[0].y + inputDir.y })


This is the code to increase the size of snake once it collides with food.

The code above that and below that, respectively, playing sound and changing the location of food once it's eaten is working. Please tell me what went wrong

What I have tried:

I've tried debugging it with no success.
Posted
Updated 10-Jan-23 16:46pm

1 solution

This issue has been fixed, I forgot to add CSS class to snake.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900