I felt like I had all of the steps worked out and the code made sense to me. But when I ran and verified... it blew up in my face. A lot of exceptions and red font on the console, not a single green check, and not even a coherent-looking grid. Any hints to help me advance on this one?
package com.codegym.games.racer;
import com.codegym.engine.cell.Game;
import com.codegym.engine.cell.*;
//Let's create the game's main class: RacerGame
//we'll make our class inherit the Game class
public class RacerGame extends Game {
public final static int WIDTH = 64;
public final static int HEIGHT = 64;
public final static int CENTER_X = WIDTH / 2;
public final static int ROADSIDE_WIDTH = 14;
@Override
public void initialize(){
setScreenSize(64, 64);
showGrid(true);
createGame();
}
private void createGame(){
drawScene();
}
private void drawScene(){
drawField();
}
private void drawField(){
//setcellcolor() for every cell down middle of road
for(int y = 0; y < 65; y++){
setCellColor(CENTER_X, y, Color.WHITE);
}
//setcellcolor() for the road
//25 is beginning of road, 39 is end
for(int x = ROADSIDE_WIDTH; x < (WIDTH - ROADSIDE_WIDTH); x++){
for(int y = 0; y < HEIGHT; y++){
if(x == CENTER_X)
continue;
setCellColor(x, y, Color.DIMGREY);
}
}
//setcellcolor() for left side of road
for(int x = 0; x < ROADSIDE_WIDTH; x++){
for(int y = 0; y < HEIGHT; y++){
setCellColor(x, y, Color.GREEN);
}
}
//setcellcolor() for right side of road
for(int x = WIDTH; x >= (WIDTH - ROADSIDE_WIDTH); x--){
for(int y = 0; y < HEIGHT; y++){
setCellColor(x, y, Color.GREEN);
}
}
}
}