java - Why does a piece of code gets executed or not at random? -
generally have map generation code, divide map 2 sectors , each 1 2 more.
i have been trying mark first pair of sectors map, reason, first sector marked nicely, , double loop second sector executed, , not.
the piece of code:
sector root = new sector(0, 0, width, height); sector levelone[] = root.dividesector(' '); system.out.println("levelonea: (" + levelone[0].getoriginx() + ", " + levelone[0].getoriginy() + ") : " + levelone[0].getwidth() + "x" + levelone[0].getheight()); (int y = levelone[0].getoriginy(); y < levelone[0].getheight(); y++){ (int x = levelone[0].getoriginx(); x < levelone[0].getwidth(); x++){ insertmappoint(new point(x, y, "sector one")); system.out.println("exe"); } } system.out.println("leveloneb: (" + levelone[1].getoriginx() + ", " + levelone[1].getoriginy() + ") : " + levelone[1].getwidth() + "x" + levelone[1].getheight()); (int y = levelone[1].getoriginy(); y < levelone[1].getheight(); y++){ (int x = levelone[1].getoriginx(); x < levelone[1].getwidth(); x++){ insertmappoint(new point(x, y, "sector two")); } }
all system.out.prinln() functions work properly, data displayed correct, second pair of loops (the ones leveloneb) 1 have problems with.
the code not relying on else. screenshot of result i'm talking about, please note put call print "exe" testing means see if second pair being executed.
thank help.
Comments
Post a Comment