2d game with libgdx where to start?

thats actually the tutorial i got the code from for the splash screen :stuck_out_tongue:

heres the splash screen
http://pastebin.java-gaming.org/909d61d7357

heres the mainmenu (the menu code is kinda the same as the tablelayoutest.java, its one of the libgdx test)
http://pastebin.java-gaming.org/4909d067d53

i get a null pointer exception whatever that means :clue:
http://pastebin.java-gaming.org/09d6d237752

You’re going to have problems if you don’t know what a NPE is. A Null Pointer Exception is basically thrown when something tries to use a null value like an object - usually you’re forgetting to initialize an object or something.
Anyways, it’s probably because you’re trying to resize() the menu screen manually before creating it, or perhaps you are feeding it null ints. Where’s the code for the Game class?

stage is null.

stage is null.

stage = new Stage();
is in the create() method…unless resize() is called before create()

theres no actual game yet but heres the main class (idk if thats what you meant by game class)
http://pastebin.java-gaming.org/9d6d337725e

yea
stage = new Stage();
is in the create() method so what do i do?

stage = new Stage();
is in the create() method…unless resize() is called before create()

theres no actual game yet but heres the main class (idk if thats what you meant by game class)
http://pastebin.java-gaming.org/9d6d337725e

yea
stage = new Stage();
is in the create() method so what do i do?

So just to confirm:

Exception in thread "LWJGL Application" java.lang.NullPointerException
   at com.me.hellrazer.screens.MainMenu.resize(MainMenu.java:92)

Based on this, you’re getting the error only when you resize the screen? ???

So just to confirm:

Exception in thread "LWJGL Application" java.lang.NullPointerException
   at com.me.hellrazer.screens.MainMenu.resize(MainMenu.java:92)

Based on this, you’re getting the error only when you resize the screen? ???

yup i guess thats what it means but i dont know how to fix that :clue:

wait… so okay… this might sound stupid of me, but I just want to make sure…

After the Splash screen, when you do “game.setScreen(new MainMenu());” you’re able to load the MainMenu properly, right?

Then, when you resize the game window (maybe you click maxmize or pull the window edges?) — that’s the only time the error occurs?

Well, stage is the only thing that could be null.

True, though I assume the create() method is imediately called once MainMenu loads from game.setScreen(new MainMenu()), right?

If that’s the case, then stage shouldn’t be null.

Also, if the error happens during resize(), I’m wondering why hellrazer21 “cant get the menu to show up after the splash screen fades out.”

yup i guess thats what it means but i dont know how to fix that :clue:

wait… so okay… this might sound stupid of me, but I just want to make sure…

After the Splash screen, when you do “game.setScreen(new MainMenu());” you’re able to load the MainMenu properly, right?

Then, when you resize the game window (maybe you click maxmize or pull the window edges?) — that’s the only time the error occurs?

Well, stage is the only thing that could be null.

True, though I assume the create() method is imediately called once MainMenu loads from game.setScreen(new MainMenu()), right?

If that’s the case, then stage shouldn’t be null.

Also, if the error happens during resize(), I’m wondering why hellrazer21 “cant get the menu to show up after the splash screen fades out.”

so do i take stage = new Stage(); out of the create method?

so do i take stage = new Stage(); out of the create method?