ok i thought it was working... but apparently not, what is wrong...
space class:
Rock class:
when i compile, is says cannot find symbol - variable counter...
help me plz
thank you
public Space()
{
// Create a new world with 800x600 cells with a cell size of 1x1 pixels.
super(800, 600, 1);
prepare();
}
/**
* Prepare the world for the start of the program. That is: create the initial
* objects and add them to the world.
*/
private void prepare()
{
RestartSun restartsun2 = new RestartSun();
RestartSun restartsun3 = new RestartSun();
addObject(restartsun3, 799, 41);
MenuMoon menumoon2 = new MenuMoon();
addObject(menumoon2, 21, 8);
Rocket rocket = new Rocket();
addObject(rocket, 68, 218);
Rock rock = new Rock(counter);
addObject(rock, 567, 374);
Rock rock2 = new Rock(counter);
addObject(rock2, 466, 222);
Rock rock3 = new Rock(counter);
addObject(rock3, 428, 45);
Rock rock4 = new Rock(counter);
addObject(rock4, 80, 338);
Rock rock5 = new Rock(counter);
addObject(rock5, 228, 290);
Rock rock6 = new Rock(counter);
addObject(rock6, 130, 58);
Rock rock7 = new Rock(counter);
addObject(rock7, 388, 337);
rocket.setLocation(94, 189);
rock4.setLocation(91, 525);
rock5.setLocation(301, 488);
rock7.setLocation(320, 383);
rock2.setLocation(540, 509);
rock.setLocation(738, 453);
rock2.setLocation(573, 527);
Rock rock8 = new Rock();
addObject(rock8, 652, 165);
rock7.setLocation(484, 373);
Rock rock9 = new Rock();
addObject(rock9, 205, 355);
Rock rock10 = new Rock();
addObject(rock10, 317, 143);
rock9.setLocation(177, 365);
rock9.setLocation(157, 348);
rock10.setLocation(313, 139);
rocket.setLocation(74, 284);
rock9.setLocation(182, 397);
rocket.setLocation(63, 302);
Bullet bullet = new Bullet();
addObject(bullet, 137, 301);
removeObject(bullet);
Counter counter = new Counter(rock);
addObject(counter, 62, 592);
counter.setLocation(56, 584);
}
}
public class Rock extends Actor
{
private int points = 0;
public Rock (Counter pointCounter)
{
}
public void act()
{
moveAndTurn();
crash();
}
public void moveAndTurn()
{
move(1);
{
if (Greenfoot.getRandomNumber(100) <10)
{
turn(Greenfoot.getRandomNumber(90) - 45);
}
if (getX() <= 5 || getY() >= getWorld().getWidth() - 5)
{
turn(180);
}if (getY() <= 5 || getY() >= getWorld().getHeight() - 5)
{
turn(180);
}
}
}
public void crash()
{
{
Actor rocket;
rocket = getOneObjectAtOffset(0, 0, Rocket.class);
if (rocket != null)
{
World world;
world = getWorld();
world.removeObject(rocket);
}
}
{
Actor Bullet;
Bullet = getOneObjectAtOffset(0, 0, Bullet.class);
if (Bullet != null)
{
World world;
world = getWorld();
world.removeObject(this);
world.removeObject(Bullet);
}
}
}
}


