Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (481)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (548)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Error When Loading TileMap - NumberFormatException  (Read 803 times)
0 Members and 1 Guest are viewing this topic.
Offline Dragon

Senior Newbie


Medals: 1
Exp: 2 years



« Posted 2013-06-18 21: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!
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #1 - Posted 2013-06-18 22:23:22 »

What's up with the sudden resurgence of Slick users O.o
I don't know Slick, but found this - basically your .tmx cannot be 0 in width or height, I guess.
Offline Dragon

Senior Newbie


Medals: 1
Exp: 2 years



« Reply #2 - Posted 2013-06-18 22:30:10 »

I'll take a look at that. Thank you!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline NegativeZero

JGO Knight


Medals: 30
Projects: 2
Exp: 3 years


Zero but not.


« Reply #3 - Posted 2013-06-19 02:26:41 »

What's up with the sudden resurgence of Slick users O.o
I don't know Slick, but found this - basically your .tmx cannot be 0 in width or height, I guess.


It's probably because before all their questions were directed to the slick website, but now that it is gone, they have come here.
Pages: [1]
  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.

atombrot (26 views)
2014-08-19 14:29:53

Tekkerue (24 views)
2014-08-16 11:45:27

Tekkerue (23 views)
2014-08-16 11:22:17

Tekkerue (14 views)
2014-08-16 11:20:21

Tekkerue (22 views)
2014-08-16 11:12:11

Rayexar (60 views)
2014-08-11 07:49:23

BurntPizza (38 views)
2014-08-10 02:09:32

BurntPizza (30 views)
2014-08-08 07:01:56

Norakomi (37 views)
2014-08-07 00:49:38

BurntPizza (67 views)
2014-08-03 07:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!