Hi,
could anyone please help me find out what's wrong with my code? The second to last condition isn't verifying:
Be sure that the drawField() method calls the draw(Game) method on each object in the stars list using this as the argument.
package com.codegym.games.spaceinvaders;
import com.codegym.engine.cell.*;
import com.codegym.games.spaceinvaders.gameobjects.Star;
import java.util.ArrayList;
import java.util.List;
public class SpaceInvadersGame extends Game {
public static final int WIDTH = 64;
public static final int HEIGHT = 64;
private List<Star> stars;
public static void main(String[] args) {
}
@Override
public void initialize() {
setScreenSize(WIDTH, HEIGHT);
createGame();
}
private void createGame() {
createStars();
drawScene();
}
private void drawScene() {
drawField();
}
private void createStars() {
stars = new ArrayList<Star>();
int x = 0;
int y = 0;
for (int i = 0; i < 8; i++) {
stars.add(i, new Star(x, y));
x += 8;
y += 8;
}
}
private void drawField() {
for (int i = 0; i < HEIGHT; i++) {
for (int j = 0; j < WIDTH; j++) {
setCellValueEx(i, j, Color.RED, "");
}
}
}
private void drawField(Game g) {
for (int i = 0; i < stars.size(); i++) {
stars.get(i).draw(this);
}
}
}