+ 4
Help with my Code
So I'm trying to mock the way the snakes move in Slither.io, but I want the head of the snake to follow the mouse position. I have a function, follow() that I've messed around with a bunch, but I just can't seem to get it to work; however, it will work if I manually make the head of the snake move by offsetting its position each frame. I've commented it out on around line 62. It's in the follow() function. Thanks in advance and Happy Coding! https://code.sololearn.com/WK8wQ0Anr96L
1 Respuesta
+ 2
I figured out my own problem eventually. After some thought-soaked guitar playing to clear my mind, I discovered that I had started the mouse.x and mouse.y as undefined values, which would have thrown everything else off. I just started them at zero and voila!