so the picture shows that the green square (snake food), spawned at the end of the right side of the canvas. That’s a section that I coded as a restricted area, where the player loses if they went in it (or should I say the whole first and last row and column are restricted areas). While stopping the snake and resetting the game wasn’t a problem, the snake food (green square) keeps spawning inside the restricted area although I’ve specified the range of its spawn coordinate.
good day,
that’s the idea it can’t be 0.
The idea is that the first row, last row, first column and last column will be a restricted area.
So, the x and y can’t be 0…
oh okay, my mistake didn’t read that bit. My new hint is:
this.x can evaluate to 600, it should never be able to do that.
You may already know that, but I think the brackets might have had you a bit confused, if you fix that line and work from there I think you’ll be able to get it. You’re very close.