Hello,

This might be a pretty stupid question but im really new to java and i am developing this space shooters game for a project. Ive gotten to a point in my game were im overridden with bugs and this is the main one that is really stopping me from advancing. I have this LevelLoader class that basically loads the game level aswell as monsters and a player. This class extends World from a library called marte engine. So that being said i need to use a specific method inside the LevelLoader class inside another class GameWorld but im running into a very annoying error. It says non-static variable cannot be referenced from a static context. This is the method that needs to be used in another class.

public static void loadLevel(StateBasedGame game) {
levelNum++;
if (Level.levelExists(levelNum)) {
this.clear();
player = new Player(getWidth() / 2, getHeight() / 2);
add(player);
level = Level.load(levelNum, this);
}
}
Is there any way around this? Any help would be appreciated ive been struggling with this error for a while now.