Hey guys. I have spend hours on figuring out how to access the variables from my actor called "counter" with my actor called "Rock". The thing is, Rock keeps being generated and i want to add 1 point each time a rock is destroyed. however i can't access the variables from counter (so i can add the point). The way i generate more Rocks is currently by using this code in my world actor:
public int a=0;
public void act()
{
a++;
if(a == threshold)
{
RandomPlacement();
a = 0;
}
}
public void RandomPlacement()
{
int x = Greenfoot.getRandomNumber(getWidth());
int y = 10;
addObject(new Rock() ,x,y); //keep in mind that it's decided by random if it adds it or not.
}
I really need help with this one... please respond :)
