|
|
@@ -8,9 +8,6 @@ int i_biggestHouse; |
|
|
|
ArrayList<SpawnArea> spawnAreas = new ArrayList<SpawnArea>(); |
|
|
|
|
|
|
|
void initHouses() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
img_houses.loadPixels(); |
|
|
|
for (int x = 0; x < img_houses.width; x++) { |
|
|
|
for (int y = 0; y < img_houses.height; y++) { |
|
|
@@ -25,12 +22,9 @@ void initHouses() { |
|
|
|
for(SpawnArea spawn : spawnAreas){ |
|
|
|
spawn.i_size = int(map(spawn.i_size,0,i_biggestHouse,0,100)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
class SpawnArea { |
|
|
|
|
|
|
|
|
|
|
|
PVector v2_center; |
|
|
|
int i_size; |
|
|
|
int i_ID; |
|
|
@@ -39,9 +33,6 @@ class SpawnArea { |
|
|
|
//text(i_size,v2_center.x,v2_center.y); |
|
|
|
text(i_ID,v2_center.x,v2_center.y); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ArrayDeque<PVector> v2d_selected = new ArrayDeque<PVector>(); |
|
|
|
ArrayList<PVector> v2d_points = new ArrayList<PVector>(); |
|
|
|
boolean isToSelect(int px, int py, int[] pxl, int pw, int ph, int orgColor) { |
|
|
@@ -49,6 +40,9 @@ class SpawnArea { |
|
|
|
return false; |
|
|
|
return pxl[px + py * pw] == orgColor; |
|
|
|
} |
|
|
|
PVector v2_randomSpawnPoint(){ |
|
|
|
return v2d_points.get(int(random(0,v2d_points.size()))); |
|
|
|
} |
|
|
|
|
|
|
|
SpawnArea(int startX, int startY) { |
|
|
|
i_ID = spawnAreas.size(); |
|
|
@@ -84,7 +78,7 @@ class SpawnArea { |
|
|
|
avgPoint.x = avgPoint.x/i_size; |
|
|
|
avgPoint.y = avgPoint.y/i_size; |
|
|
|
v2_center = avgPoint; |
|
|
|
|
|
|
|
|
|
|
|
if(i_size > i_biggestHouse) i_biggestHouse = i_size; |
|
|
|
|
|
|
|
} |