Hi,
i have a problem with my greenfoot simulation. In my world class ("plane") i'm using the method createSeats() to create the world.
The variables/arrays (sitze, S, AReihen, sitzeArray, freieSitze, r) created in createSeats() are used in the method act() of the same class in which i want to spawning my actors when the simluation runs. When compiling it gives a "cannot find symbol" error due to the fact the variables can't be accessed from another method in the same class i guess.
Putting act() into public Plane() wouldn't work too because then it would start itself i guess...
Thanks in advance!!
public Plane() { super(3+3+1, 20, 32); setBackground("tile.png"); createSeats(3, 20); ID = 0; } public void createSeats(int S, int AReihen) { int ASitze = (S+S) * AReihen; sitze = new int[ASitze*3]; int[] sitzeArray = new int[ASitze]; int r; int freieSitze = ASitze; Random generator = new Random(); for (int i=0;i<ASitze;i++) { sitzeArray[i]=i; } System.out.println("Seats (ID|y|x)"); for (int cnt1 = 0; cnt1 < AReihen; cnt1++) { for (int cnt2 = 0; cnt2 < S+S + 1 ; cnt2++) { if (cnt2 != S) { int x = cnt2; int y = cnt1; Seat seat = new Seat(); addObject(seat, x, y); sitze[ID*3]=ID; // Array Zugriff sitze[ID*3+1]=y; sitze[ID*3+2]=x; System.out.println("id_" + sitze[ID*3] + " ( " + sitze[ID*3+1] + " | " + sitze[ID*3+2] + " )"); ID++; } } } }