So i have built a Scene class which extends World:
Now, I want to be able to have a Main class, from where I would declare a Scene and use it thorough the game. This was my attempt:
However, this already gives a ton of errors on the second s.SetScene(0) line. Any idea what I'm doing wrong or a better way to do it?
import java.util.Arrays;
import java.util.List;
import greenfoot.*;
public class Scene extends World
{
public static int WIDTH = 1600;
public static int HEIGHT = 900;
public static int Cell_size = 1;
public static int X_INIT = 1;
public static int Y_INIT = 1;
int k;
Actor Actor_Principal;
List<String> Lista_Fundal = Arrays.asList(
"facing.png"
);
public void SetScene(int Scene_Number) //Definirea parametrilor initiali ai scenei
{
setBackground(Lista_Fundal.get(Scene_Number));
}
public Scene() //Constructor scena
{
super(WIDTH, HEIGHT, Cell_size);
}
}
public class Main {
Scene s = new Scene();
s.SetScene(0);
}
