Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (498)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 2 [3] 4
  ignore  |  Print  
  2d game with libgdx where to start?  (Read 13213 times)
0 Members and 1 Guest are viewing this topic.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 114
Projects: 4
Exp: 3 years



« Reply #60 - Posted 2013-05-02 03:57:56 »

Annotations, put them on the line above the method:
1  
2  
@Override
public void ...
Offline ReBirth
« Reply #61 - Posted 2013-05-02 03:59:23 »

You have no 'white' declaration on your uiskin.json.

Offline hellrazer21

Junior Member





« Reply #62 - Posted 2013-05-02 04:40:52 »

i put the @override and now i  get this
http://pastebin.java-gaming.org/2e408436459

whats the white declaration?


heres the uiskin.json
http://pastebin.java-gaming.org/e4083546950


There's around 5 hours of video tutorials here spread out over 10 videos guiding the viewer through a single project:

http://www.youtube.com/user/doctoriley/videos

Seems awesome.

i've seen a few of his videos their not bad i got the code for the splash screen from his vids
its kinda usefull
but he dosen't actually finish the game he ends it with a lame spaceship stuck in the middle of the screen that shoots where you click

if i manage to get a good grip on libgdx i'll be sure to make a tutorial, a noob friendly one too

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ReBirth
« Reply #63 - Posted 2013-05-02 10:07:37 »

Try remove this
1  
2  
3  
com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
   dialogDim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.45 } }
},

Offline hellrazer21

Junior Member





« Reply #64 - Posted 2013-05-06 22:52:38 »

thanks for the help guys i got the menu working but i hit a little problem here

so i can manage to load the splash screen after the main like this, it works no problem
1  
2  
3  
public void create() {
      setScreen(new SplashScreen());
   }

and i can load up a tablelayout by setting it up in the main (i just put the table layout test in as the main)
it works

but i cant get the menu to show up after the splash screen fades out

i was thinking maybe i should figure out how to setup the abstract screen

i came across this project but they call it screen manager the source is at the bottom
im trying to figure out how to use it with the code i have right now
http://bioboblog.blogspot.com/2012/08/libgdx-screen-management.html

this is the same thing as abstractscreen right?
 

Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #65 - Posted 2013-05-07 00:40:39 »

^ Does something here help?

Creating a Game in Java - Episode 3: Switching Screens

<a href="http://www.youtube.com/v/TmI7DRlGYq4?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/TmI7DRlGYq4?version=3&amp;hl=en_US&amp;start=</a>

Offline hellrazer21

Junior Member





« Reply #66 - Posted 2013-05-07 07:24:15 »

thats actually the tutorial i got the code from for the splash screen 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 Clueless
http://pastebin.java-gaming.org/09d6d237752

Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 114
Projects: 4
Exp: 3 years



« Reply #67 - Posted 2013-05-07 07:29:54 »

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?
Offline HeroesGraveDev

JGO Kernel


Medals: 212
Projects: 11
Exp: 2 years


If it wasn't Awesome, it wasn't me.


« Reply #68 - Posted 2013-05-07 07:46:14 »

stage is null.

Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 114
Projects: 4
Exp: 3 years



« Reply #69 - Posted 2013-05-07 19:04:54 »

stage = new Stage();
is in the create() method...unless resize() is called before create()
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline hellrazer21

Junior Member





« Reply #70 - Posted 2013-05-07 21:23:53 »

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?

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

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

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

Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #71 - Posted 2013-05-08 07:08:06 »

So just to confirm:

1  
2  
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? Huh

Offline hellrazer21

Junior Member





« Reply #72 - Posted 2013-05-08 09:55:30 »

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


Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #73 - Posted 2013-05-08 10:52:09 »

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?

Offline HeroesGraveDev

JGO Kernel


Medals: 212
Projects: 11
Exp: 2 years


If it wasn't Awesome, it wasn't me.


« Reply #74 - Posted 2013-05-08 11:12:39 »

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

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

Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #75 - Posted 2013-05-08 11:41:10 »

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

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."

Offline hellrazer21

Junior Member





« Reply #76 - Posted 2013-05-08 22:49:46 »

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

Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #77 - Posted 2013-05-09 01:46:13 »

^ no that seems correct.

Could you just clear up something for me first? Here's my question:

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?
Thanks!

Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #78 - Posted 2013-05-09 01:49:44 »

EDIT: wrong thread.

Offline hellrazer21

Junior Member





« Reply #79 - Posted 2013-05-09 04:13:44 »

after the splash screen nothing loads it just gives me that null pointer exception

Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #80 - Posted 2013-05-09 04:38:37 »

after the splash screen nothing loads it just gives me that null pointer exception

Well now that's weird...

...because as far as I understand it, your error seems to happen during resize(), which is called when, well, the screen is resized.

I don't know in what scenario resized() is called upon loading the screen... anyone? Huh

Offline ReBirth
« Reply #81 - Posted 2013-05-09 04:44:05 »

Resize() method will be always called at least once on screen creation.

Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #82 - Posted 2013-05-09 04:47:54 »

Resize() method will be always called at least once on screen creation.
Ah I didn't know that, thanks! Grin

Although now, idk what the NPE is for since it looks like screen isn't be null....

Offline ReBirth
« Reply #83 - Posted 2013-05-09 05:00:06 »

When your game loaded, the screen is literally changed from 0x0 to WxH. That's where the resize() called. *)

From resize's comment
Quote
Called when the {@link Application} is resized. This can happen at any point during a non-paused state but will never happen before a call to {@link #create()}.

*) disclaimer: Not my find. I read it somewhere but forget the link.

Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #84 - Posted 2013-05-09 05:04:12 »

Just in case you're confusing me with hellrazer21, this is not my game, it's hellrazer21's Smiley I'm just trying to help out, but it's nice to have that knowledge that resize() is called when the screen is loaded. Might help me in the future with my own projects Tongue

Offline hellrazer21

Junior Member





« Reply #85 - Posted 2013-05-09 10:03:34 »

so how would you guys go about doing this? cause im probably just going to look for a working project and just start modifying it to make it work the way i want.
all this copying and pasting code has been nothing but problems  Emo

Offline ReBirth
« Reply #86 - Posted 2013-05-09 13:18:57 »

Quote
so how would you guys go about doing this?
Through painful trial and error, desperate google search, endless daydreaming, etc

Offline Nate

JGO Kernel


Medals: 128
Projects: 3
Exp: 14 years


Esoteric Software


« Reply #87 - Posted 2013-05-09 14:28:33 »

I would try to understand the code. You can't expect to cobble together some code snippets and have them work without understanding what is going on.

Offline ReBirth
« Reply #88 - Posted 2013-05-09 16:14:09 »

Also you will have no idea about the status of the copied code. LibGDX is still on heavy dev (right Nate?) and the API or underneath behaviors maybe changed, resulting explosion of error.

For example, I find out most of tutorial code needs to be updated after Drawable introduction (Image class has setDrawable() instead setRegion()).

Offline heisenbergman

JGO Coder


Medals: 14
Projects: 1


L___ o_ G___ a__ P___


« Reply #89 - Posted 2013-05-09 16:20:29 »

what's the best way to keep tabs on official changes/updates to everything related to libgdx?

Pages: 1 2 [3] 4
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (15 views)
2014-04-15 18:08:23

BurntPizza (13 views)
2014-04-15 03:46:01

UprightPath (27 views)
2014-04-14 17:39:50

UprightPath (12 views)
2014-04-14 17:35:47

Porlus (29 views)
2014-04-14 15:48:38

tom_mai78101 (51 views)
2014-04-10 04:04:31

BurntPizza (110 views)
2014-04-08 23:06:04

tom_mai78101 (211 views)
2014-04-05 13:34:39

trollwarrior1 (179 views)
2014-04-04 12:06:45

CJLetsGame (185 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!