nnn1590 / KirbyGame-Java

A parody of the Kirby game NOTE: dist won't work correctly. The execution method is a bit special; See https://github.com/nnn1590/KirbyGame-Java/issues/1.
0 stars 0 forks source link

dist.zip does not work properly #1

Open nnn1590 opened 4 years ago

nnn1590 commented 4 years ago

https://github.com/nnn1590/KirbyGame-Java/blob/6cbd5a4f43497c2bd87ead1e9698d06895f48ad6/src/main/java/Kirby/KirbyGame.java#L544-L546

map = new TiledMap("kirbymap.tmx","src/main/resources");

is almost the same.

./gradlew run works properly.

But

./gradlew distzip
cd $(mktemp -d Kirby-XXXXXX -p /tmp)
unzip "${OLDPWD}/build/distributions/Kirby.zip"
Kirby/bin/Kirby

cd -
rm -r ${OLDPWD}

doesn't work.

Error log ``` ERROR:Resource not found: src/main/resources/kirbyterrain.png java.lang.RuntimeException: Resource not found: src/main/resources/kirbyterrain.png at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:185) at org.newdawn.slick.Image.(Image.java:192) at org.newdawn.slick.tiled.TileSet.(TileSet.java:124) at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:661) at org.newdawn.slick.tiled.TiledMap.(TiledMap.java:122) at Kirby.KirbyGame.level1Setup(KirbyGame.java:545) at Kirby.KirbyGame.initStatesList(KirbyGame.java:350) at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164) at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317) at Kirby.KirbyGame.main(KirbyGame.java:557) Fri Jan 31 23:22:11 JST 2020 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.(TiledMap.java:122) at Kirby.KirbyGame.level1Setup(KirbyGame.java:545) at Kirby.KirbyGame.initStatesList(KirbyGame.java:350) at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164) at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317) at Kirby.KirbyGame.main(KirbyGame.java:557) Caused by: java.lang.RuntimeException: Resource not found: src/main/resources/kirbyterrain.png at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:185) at org.newdawn.slick.Image.(Image.java:192) at org.newdawn.slick.tiled.TileSet.(TileSet.java:124) at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:661) ... 7 more ```
nnn1590 commented 4 years ago

If kirbyterrain.png is in the current directory with map = new TiledMap("kirbymap.tmx",".");, it will work properly

./gradlew distzip
cd $(mktemp -d Kirby-XXXXXX -p /tmp)
unzip "${OLDPWD}/build/distributions/Kirby.zip"
cd Kirby/lib
../bin/Kirby