public void update(int elapsedTimeMilisec) { for (Projectile p : projectileList) { p.update(elapsedTimeMilisec); } // Remove inactive invaders for (int i = this.projectileList.size() - 1; i >= 0; i--) { if (this.projectileList.get(i).isRemoved()) { this.projectileList.remove(i); } } for (Wall w : this.walls) { w.clearPieces(); } for (Animation explosion : Game.explosionList) { explosion.update(elapsedTimeMilisec); } for (int i = this.walls.size() - 1; i >= 0; i--) { if (walls.get(i).isRemoved()) { walls.remove(i); } } }
public void render(int xOffset, int yOffset, Screen screen) { int x0 = xOffset; int y0 = yOffset; int x1 = x0 + screen.getWidth(); int y1 = y0 + screen.getHeight(); for (int y = y0; y < y1; y++) { for (int x = x0; x < x1; x++) { screen.pixels[x + y * screen.getWidth()] = pixels[x + y * width]; } } for (Projectile p : projectileList) { p.render(screen); } for (Wall w : walls) { w.render(screen); } for (Animation explosion : Game.explosionList) { explosion.render(screen); } }