So basicly i am trying to create a 2 dimensional array for my snake game but i am haveing some trouble:
public static Tile gameField[][];
gameField = new Tile[FIELD_HEIGHT][FIELD_WIDTH];
for(int i=0;i<FIELD_HEIGHT;i++){
for(int j=0;j<FIELD_WIDTH;j++){
gameField[i][j] = new Tile();
}
}
gameField[1][1].snake = false;
gameField[1][2].snake = true;
System.out.println(gameField[1][1].snake+"_"+gameField[1][2].snake);
//Prints: true_true
public class Tile {
public static boolean snake;
public static int id;
}
I´d appreciate if someone could help me with this problem.