Where is the condition I said you should put in there? That method should look more like the following at this point:
which adds the condition that the length be less than 10 in order to increase the size of the snake.
private void eat()
{
Actor food=getOneObjectAtOffset(0, 0, Food.class);
if (food!=null){
SnakeEarth snakeEarth=(SnakeEarth)getWorld();
snakeEarth.removeObject(food);
if(length<10) {
snakeEarth.addArray();
snakeEarth.snake[length]=new Snake();
snakeEarth.addObject(snakeEarth.snake[length], getX(), getY());
length++;
}
}
}

