1
0

Add smooth terrain blocks

This commit is contained in:
Victor 2014-03-15 09:57:25 +02:00
parent 41eedcea47
commit 6bc10cf9af

View File

@ -71,6 +71,10 @@ public class Terrain implements Constants {
if (blockHeights[i] > maxHeight) blockHeights[i] = maxHeight;
else if (blockHeights[i] < 0) blockHeights[i] = 0;
}
// Smooth blocks
for (int i = 1; i < blocksCount - 1; i += 2) {
blockHeights[i] = (blockHeights[i - 1] + blockHeights[i + 1]) / 2;
}
// Flatten out left and right blocks for turrets.
for (int i = 0; i < PLAYERS_BLOCK_COUNT; i++) {
blockHeights[i] = getFirstBlockHeight();