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 (497)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / [LibGDX]Box2dLights Rendering Issue on: 2014-01-14 05:25:20
Hiya,
So, I have a map like this:


Sometime I'm going to add in some stuff and I would like to add in some lights. I took a look at Box2dLights and set it up and it works great (Nice and simple), however I'm not able to do what I want to do. I would like to add in lights that will not affect the lighting anywhere on the scene except where the light is and where it extends to.

I tried moving the RayHandler updateAndRender method around my render method to try different rendering positions, but it didn't do anything to help with my problem. When I put it so that it renders the light after my player and map render methods, it looks good, but where the light it is the only place where there is light. Everywhere else is completely black, but I think that is how the light is supposed to work (not sure).

Sorry if this post was confusing at all. Let me know if you need any more information or if you would like me to restate something.

Thanks!
2  Game Development / Newbie & Debugging Questions / Re: Why isn't drawing a Sprite working? on: 2013-08-19 20:33:52
I played around with it for a little bit, and I found the issue, but didn't solve it.

Pretty much, the main game class sets the screen to MainMenu. MainMenu then runs its show method once then never runs its render method, and switches back to the main game class render method. Why is it doing this?

 I have no idea what to do here because I've tried copying and pasting code from another screen class I made for a different project, pasting it in, then changing all the names and everything, and it still doesn't work.

EDIT: I figured out the issue. I had to add super.render(); to the main game class. Ugh, I can't believe I forgot that, and was trying to figure out the problem for a couple hours now DX. I guess that's programming though Wink
3  Game Development / Newbie & Debugging Questions / Why isn't drawing a Sprite working? on: 2013-08-19 19:48:28
Hi everyone. I'm having an issue, and it's really frustrating because of how simple it is Tongue . Drawing a Sprite isn't working at all. I'm using LibGDX.

For example, with this code, when I draw the sprite, it is flashing really fast.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
@Override
   public void show() {
      batch = new SpriteBatch();

      texture = new Texture("ui/mainmenu.png");
      mainMenu = new Sprite(texture);
      mainMenu.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
     
      batch.begin();
      mainMenu.draw(batch);
      batch.end();
   }

   @Override
   public void render(float delta) {
      Gdx.gl.glClearColor(0, 0, 0, 1);
       Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
   }


but with this code, my sprite doesn't show up at all.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
   @Override
   public void show() {
      batch = new SpriteBatch();

      texture = new Texture("ui/mainmenu.png");
      mainMenu = new Sprite(texture);
      mainMenu.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
   }

   @Override
   public void render(float delta) {
      Gdx.gl.glClearColor(0, 0, 0, 1);
       Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
       
       batch.begin();
       mainMenu.draw(batch);
       batch.end();
   }


Thanks in advance Smiley
4  Game Development / Newbie & Debugging Questions / Re: Error When Loading TileMap - NumberFormatException on: 2013-06-19 00:30:10
I'll take a look at that. Thank you!
5  Game Development / Newbie & Debugging Questions / Error When Loading TileMap - NumberFormatException on: 2013-06-18 23:01:19
Hello!
I've been playing around and learning Slick2d lately, and I decided to do a Tile Map. However, when I try and load it, it gives me an error. First, this is the error:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
Tue Jun 18 14:58:40 MDT 2013 INFO:Slick Build #237
Tue Jun 18 14:58:40 MDT 2013 INFO:LWJGL Version: 2.9.0
Tue Jun 18 14:58:40 MDT 2013 INFO:OriginalDisplayMode: 1440 x 900 x 32 @60Hz
Tue Jun 18 14:58:40 MDT 2013 INFO:TargetDisplayMode: 960 x 600 x 0 @0Hz
Tue Jun 18 14:58:40 MDT 2013 INFO:Starting display 960x600
Tue Jun 18 14:58:40 MDT 2013 INFO:Use Java PNG Loader = true
Tue Jun 18 14:58:40 MDT 2013 INFO:Controllers not available
Tue Jun 18 14:58:40 MDT 2013 ERROR:For input string: ""
java.lang.NumberFormatException: For input string: ""
   at java.lang.NumberFormatException.forInputString(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at org.newdawn.slick.tiled.TiledMap$GroupObject.<init>(TiledMap.java:1079)
   at org.newdawn.slick.tiled.TiledMap$ObjectGroup.<init>(TiledMap.java:1033)
   at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:688)
   at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:106)
   at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:90)
   at com.dragon.Level1.init(Level1.java:21)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
   at com.dragon.Main.main(Main.java:29)
Tue Jun 18 14:58:40 MDT 2013 ERROR:Failed to parse tilemap
org.newdawn.slick.SlickException: Failed to parse tilemap
   at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:695)
   at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:106)
   at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:90)
   at com.dragon.Level1.init(Level1.java:21)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
   at com.dragon.Main.main(Main.java:29)
Caused by: java.lang.NumberFormatException: For input string: ""
   at java.lang.NumberFormatException.forInputString(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at org.newdawn.slick.tiled.TiledMap$GroupObject.<init>(TiledMap.java:1079)
   at org.newdawn.slick.tiled.TiledMap$ObjectGroup.<init>(TiledMap.java:1033)
   at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:688)
   ... 7 more


Here is the class that is causing the problem:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
package com.dragon;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
import org.newdawn.slick.tiled.TiledMap;

public class Level1 extends BasicGameState {
   int stateID  = 4;
   
   private TiledMap map;
   
   public Level1(int state) {
      stateID = state;
   }

   @Override
   public void init(GameContainer container, StateBasedGame game) throws SlickException {
      map = new TiledMap("/res/world/level.tmx"); //Error
  }

   @Override
   public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {

   }

   @Override
   public void update(GameContainer container, StateBasedGame game, int delta)   throws SlickException {
     
   }

   @Override
   public int getID() {
      return stateID;
   }

}


I know that it's the map = new TiledMap... line that's causing this because of the error message. When I comment that line out, the game works fine. Thanks!
6  Game Development / Newbie & Debugging Questions / Re: Where to go From Where I'm at? on: 2013-05-14 03:48:34
Cool, thank you  Grin
7  Game Development / Newbie & Debugging Questions / Where to go From Where I'm at? on: 2013-05-14 03:29:00
Hello. So, I've learned the basics/intermediate of java, and would like to start game developing. I've downloaded and setup LibGDX, but now I'm not sure where to go from here. Are there any resources that you have to start with LibGDX? Thanks!
Pages: [1]
 

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 (11 views)
2014-04-15 18:08:23

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

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

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

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

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

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

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

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

CJLetsGame (182 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!