//Add a new snake element to the list and increase the score private void AddSnakeBody() { SnakeBody body = new SnakeBody(); snake.Add(body); int snakeLenght = snake.Count - 1; snake[snakeLenght].x = snake[1].x; snake[snakeLenght].y = snake[1].y; //Add to score currentScore = currentScore + 1; }
//Create snake elements, and add them to the snake list private void CreateSnake() { snake = new List <SnakeBody>(); for (int i = 0; i < 3; i++) { SnakeBody body = new SnakeBody(); snake.Add(body); if (i != 0) { snake[i].y = snake[i - 1].y + 20; } } }