Witam.
Chciałbym aby dzięki wylosowanemu
pole[osX][osY]
móc oddziaływać na utworzoną planszę Plansza[][] plansza = Plansza.stworzPlansze()
i np utworzyć na tym polu setStatek()
Mógłby ktoś podpowiedzieć jak to zrobić?
public class GraWPortale {
public static void main(String[] args) {
Plansza[][] plansza = Plansza.stworzPlansze();
}
}
public class Plansza {
private static Plansza[][] plansza = new Plansza[7][7];
private static Plansza[][] pole = new Plansza[7][7];
boolean statek;
public boolean getStatek() {
return statek;
}
public void setStatek(boolean p1) {
statek = p1;
}
public static Plansza losujPole() {
int osX = (int) (Math.round(Math.random()*7));
int osY = (int) (Math.round(Math.random()*7));
return pole[osX][osY];
}
public static Plansza[][] stworzPlansze() {
for (int x = 0; x <= 6; x++) {
for (int y = 0; y <= 6; y++) {
plansza[x][y] = new Plansza();
}
}
return plansza;
}
}