where is the bug in my code ?
// organize the classes in the Games of the codegym
package com.codegym.games.snake;
// import the engine class
import com.codegym.engine.cell.*;
/*
* this exercise contian the code of the Snake Game in codegym
*SnakeGame Calss inherit from Gam calss
*@Autor Mohamad Alkasem
*/
public class SnakeGame extends Game {
/*
*@param width: width of the screen
*@ param height: hieght of the screen
*/
public static final int WIDTH = 15;
public static final int HEIGHT = 15;
// private filed
private Snake snake;
private int turnDelay;
/*
* this Override Methode from super class Game
* WIDTH and HEIGHT will be initialized
* @param WIDTH
* @param HEIGHT
* @param return: would return nothing. void Methode return nothing
*/
@Override
public void initialize(){
//Game gameSet = new Game();
// call and set setScreenSize with WIDTH and HEIGHT size of the screen
setScreenSize(WIDTH, HEIGHT);
this.createGame();
}
/*
* createGame: method for action
* drawScene: for drawing the secreen
*/
private void createGame(){
Snake snake = new Snake(WIDTH / 2, HEIGHT / 2);
this.snake = snake;
snake.draw(this);
this.drawScene();
turnDelay = 300;
setTurnTimer(turnDelay);
//Apple apple = new Apple(7, 7);
// apple.draw(this);
}
private void drawScene() {
for (int x = 0; x < WIDTH; x++){
for(int y = 0; y < HEIGHT; y++){
setCellColor(x, y, Color.PURPLE);
}
}
snake.draw(this);
//setCellColor(x, y, Color.DARKSEAGREEN);
}
@Override
public void onTurn(int t){
snake.move();
drawScene();
}
}