why the compiler swears at the public GameObject createNewHead () method ??
line 83
package com.codegym.games.snake;
import com.codegym.engine.cell.*;
public class SnakeGame extends Game{
public static final int WIDTH = 15;
public static final int HEIGHT =15;
private Snake snake;
private int turnDelay;
private Apple apple;
@Override
public void initialize(){
setScreenSize(WIDTH, HEIGHT);
createGame();
}
private void createGame(){
createNewApple();
snake = new Snake(WIDTH/2, HEIGHT/2);
drawScene();
turnDelay = 300;
setTurnTimer(turnDelay);
}
private void drawScene(){
for (int x = 0; x < WIDTH; x++) {
for (int y = 0; y < HEIGHT; y++) {
setCellValueEx(x, y, Color.DARKSEAGREEN, "");
}
}
snake.draw(this);
apple.draw(this);
}
@Override
public void onTurn(int step){
snake.move(apple);
if(apple.isAlive == false){
createNewApple();
}
drawScene();
}
@Override
public void onKeyPress(Key key){
if(key == Key.LEFT){
snake.setDirection(Direction.LEFT);
} else if (key == Key.RIGHT){
snake.setDirection(Direction.RIGHT);
} else if (key == Key.UP){
snake.setDirection(Direction.UP);
} else if (key == Key.DOWN){
snake.setDirection(Direction.DOWN);
}
}
private void createNewApple(){
int x = getRandomNumber(WIDTH);
int y = getRandomNumber(HEIGHT);
apple = new Apple(x, y);
}
}