How To Make Notead Games

0 votes
asked Oct 28, 2020 in 3D Segmentation by webdesignplus69 (18,800 points)

Generating Food for the Snake


For our snake food, we have to how to make notead games generate a random set of coordinates. We can use a helper function randomTen to produce two numbers. One for the x-coordinate and one for the y-coordinate. We also have to make sure that the food is not located where the snake currently is. If it is, we have to generate a new food location.

Growing the Snake
Growing our snake is simple. We can update our advanceSnake function to check if the head of the snake is touching the food. If it is we can skip removing the last part of the snake and create a new food location.

Please log in or register to answer this question.

Welcome to Bioimagingcore Q&A, where you can ask questions and receive answers from other members of the community.
...