hey I am compiling this program
http://thejavablog.wordpress.com/2008/06/08/using-slick-2d-to-write-a-game/#comment-210and I get this exception because of rendering the map.
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
| java.lang.ArrayIndexOutOfBoundsException: 3 at org.newdawn.slick.SpriteSheet.renderInUse(SpriteSheet.java:235) at org.newdawn.slick.tiled.TiledMap$Layer.render(TiledMap.java:792) at org.newdawn.slick.tiled.TiledMap.render(TiledMap.java:348) at org.newdawn.slick.tiled.TiledMap.render(TiledMap.java:295) at WizardGame.render(WizardGame.java:128) at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:576) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:371) at WizardGame.main(WizardGame.java:36) at __SHELL43.run(__SHELL43.java:7) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at bluej.runtime.ExecServer$3.run(ExecServer.java:792) Tue Feb 17 20:44:01 CET 2009 ERROR:Game.render() failure - check the game code. org.newdawn.slick.SlickException: Game.render() failure - check the game code. at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:579) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:371) at WizardGame.main(WizardGame.java:36) at __SHELL43.run(__SHELL43.java:7) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at bluej.runtime.ExecServer$3.run(ExecServer.java:792) |
Here is my tmx file. I know it has to do with the rocks part.
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map SYSTEM "http://mapeditor.org/dtd/1.0/map.dtd">
<map version="1.0" orientation="orthogonal" width="50" height="50" tilewidth="35" tileheight="35">
<tileset name="grass" firstgid="1" tilewidth="35" tileheight="35">
<image source="grass.jpg"/>
</tileset>
<tileset name="rocks" firstgid="10" tilewidth="34" tileheight="34"> <image source="rocks.jpg"/> <tile id="0"> <properties> <property name="blocked" value="true"/> </properties> </tile> <tile id="1"> <properties> <property name="blocked" value="true"/> </properties> </tile> <tile id="2"> <properties> <property name="blocked" value="true"/> </properties> </tile> <tile id="3"> <properties> <property name="blocked" value="true"/> </properties> </tile> <tile id="4"> <properties> <property name="blocked" value="true"/> </properties> </tile> <tile id="5"> <properties> <property name="blocked" value="true"/> </properties> </tile> <tile id="6"> <properties> <property name="blocked" value="true"/> </properties> </tile> <tile id="7"> <properties> <property name="blocked" value="true"/> </properties> </tile> <tile id="8"> <properties> <property name="blocked" value="true"/> </properties> </tile> </tileset> <layer name="Layer 0" width="50" height="50">
<data encoding="base64" compression="gzip">
H4sIAAAAAAAAAO3DAQkAAAwEoeP7h16OgYKrpqqqqqqqqqqqqs8fnVCA3hAnAAA=
</data>
</layer>
</map> |