fixed chunk neighbor orientation
This commit is contained in:
@@ -26,6 +26,8 @@ public class Level {
|
||||
chunkResX = sizeX / chunksX;
|
||||
chunkResY = sizeY / chunksY;
|
||||
|
||||
GD.Print($"{chunksX}x{chunksY} chunks. {chunkResX}:{chunkResY} res each.");
|
||||
|
||||
image = Image.Create(sizeX, sizeY, false, Image.Format.Rgb8);
|
||||
|
||||
chunks = new Chunk[chunksX, chunksY];
|
||||
@@ -40,11 +42,12 @@ public class Level {
|
||||
for (int x = 0; x < chunksX; x++) {
|
||||
for (int y = 0; y < chunksY; y++) {
|
||||
|
||||
if (x > 0) chunks[x, y].NeighborN = chunks[x-1, y];
|
||||
if (x < chunksX-1) chunks[x, y].NeighborS = chunks[x+1, y];
|
||||
if (y > 0) chunks[x, y].NeighborN = chunks[x, y-1];
|
||||
if (y < chunksY-1) chunks[x, y].NeighborS = chunks[x, y+1];
|
||||
|
||||
if (x > 0) chunks[x, y].NeighborE = chunks[x-1, y];
|
||||
if (x < chunksX-1) chunks[x, y].NeighborW = chunks[x+1, y];
|
||||
|
||||
if (y > 0) chunks[x, y].NeighborW = chunks[x, y-1];
|
||||
if (y < chunksY-1) chunks[x, y].NeighborE = chunks[x, y+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user