Hello, I am working on a simple game. I am unable to add Level 2 Aliens to myWorld after the previous aliens have been destroyed. I have created a counter which works for the stars but not for the SmallAliens. How may I fix this issue? Thank you!
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class ScoreBoard here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class ScoreBoard
{
private MyWorld world;
private int nextStarXCoord = 50;
public static int alien_counter = 10;
public ScoreBoard(MyWorld world)
{
this.world = world;
}
public void addStar()
{
if (alien_counter > 0) {
world.addObject(new Star(), nextStarXCoord, 45);
nextStarXCoord += 50;
alien_counter--;
}
}
private void AddSmallAlien() {
if (alien_counter == 6) {
SmallAlien smallalien = new SmallAlien();
world.addObject(smallalien, 900, 100);
SmallAlien smallalien2 = new SmallAlien();
world.addObject(smallalien2, 900, 500);
SmallAlien smallalien3 = new SmallAlien();
world.addObject(smallalien3, 100, 500);
SmallAlien smallalien4 = new SmallAlien();
world.addObject(smallalien4, 100, 100);
}
}
}

