i use intellij idea community edition. when run game through ide, works properly. export runnable jar, , acts if can't find map text file. looked through jar winrar , found map file there in correct place.
this how lines map file:
list<string> filelines = new arraylist<>(); try (bufferedreader br = new bufferedreader(new inputstreamreader( game.class.getresourceasstream("resources/" + file)))) { string line; while ((line = br.readline()) != null) filelines.add(line); } catch (exception e) { logger.log("could not find map file " + file + "!", logger.loglevel.severe); } that code start of method map.loadmap(string file).
how use it:
map map = map.loadmap("test.map"); map.init(); the jar file works program when running in ide when comment 2 lines out. isn't map.init() isn't working, map.loadmap() (i debugged little). problems?
edit
example map file: http://pastebin.com/rmhs1xzb
- first line: name
- second , third lines: width , height
- rest: tiles (0 grass, 1 wall)
Comments
Post a Comment