Wednesday, 15 July 2015

java - Correct use of labels in loops -



java - Correct use of labels in loops -

im looking error in app , looks here:

for (int y=0; y<map_height; y+=10) { (int x=0; x<map_width; x+=10) { label: (gameresource res : resources) { //checks if object @ given point if (res.getarea().contains(new point2d.float(x, y))) { go on label; } } if ((int)(math.random()*200) == 0) { resources.add(new gametree(x, y)); } if ((int)(math.random()*400) == 0) { resources.add(new gamemine(x, y)); } } }

it creates map. checked, , looks if object in given point, resources placed despite it. have used label correctly? if point used want go next iteraton in x-for loop.

if want go next iteration of x loop, label should on x loop:

label: (int x = 0; x < map_width; x += 10)

java

No comments:

Post a Comment