i got the error : method does not override or implement a method from a supertype
@Override
I don't know what is my mistake .It' like i have a non-existing method of the parent class Game overriden , but i did exactly as demanded.
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;
@Override
public void initialize() {
setScreenSize(WIDTH, HEIGHT);
createGame();
}
private void createGame(){
turnDelay=300;
snake= new Snake(WIDTH/2,HEIGHT/2);//why should the snake be intialized
//before drawing the Scene ?
drawScene();
//Apple apple = new Apple(7,7);
//apple.draw(this);//this tarje3 3al class mta3 apple (Apple)
setTurnTimer(turnDelay);
}
private void drawScene(){
for (int i = 0; i < WIDTH; i++) {
for (int j = 0; j < HEIGHT; j++) {
setCellColor(i, j, Color.GRAY);
}
}
snake.draw(this);//this here refers to the snake class(Snake)
}
//the requirements said : this method should be overriden but the compiler said
//there is no such function in super class
@Override
public void OnTurn(int step){
//Everything that should happen in the game during one turn is described here
snake.move();
drawScene();// drawScene() after every move ?
}
}