dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Java Beginner. Please Help!

  1. #1
    Join Date
    Jan 2012
    Posts
    1

    Java Beginner. Please Help!

    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.

  2. #2
    Join Date
    Apr 2010
    Location
    Salem,Ma
    Posts
    623
    This is the JavaSCRIPT forum, not JAVA, sorry.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles