java - Only load one png file with class.getResourceAsStream(stringPath) -
i'am trying finish first java game slick2d library. had working in eclipse when make jar file of did realize had use class loader load png - spritesheets.
but problem. resourceloader class looks this:
public static inputstream load(string path){ inputstream input = myresourceloader.class.getresourceasstream(path); if(input==null){ input = myresourceloader.class.getresourceasstream("/"+path); } return input; } my init-method in basicgame class, try load png-files looks this:
public void init(gamecontainer arg0) throws slickexception { inputstream inputstream1 = myresourceloader.load("images/piratr.png"); sprite1 = new spritesheet("",inputstream1,32,32); inputstream inputstream2 = myresourceloader.load("images/monkey.png"); sprite2 = new spritesheet("",inputstream2,32,32); animation1 = new animation(sprite1,200); animation2 = new animation(sprite2,250); } and works fine loading first png-file(eg piratr.png), whenever try load file loads first 1 again. in case sprite1 , sprite2 looks same though there different images.
i have been trying straight weeks, if theres how tell me aim doing wrong or point me in right direction grateful. // anders, sweden
Comments
Post a Comment