I'm trying build sanke game but my code find this wrong

getRandomFoodPosition( ){
let newFoodPosition
while (newFoodPosition == null || onSnake(newFoodPosition)){
newFoodPosition = randomGridPosition()
}
return newFoodPosition

}

in pen you’ll can see the whole food.js https://codepen.io/spoonerboy/pen/wvXdgBE

And what’s the important thing?

AH function, , i get it

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.