Skip to content

Commit 5206ed7

Browse files
Grass and Sand for the terrain
Instead of the mix of ores
1 parent 55836eb commit 5206ed7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Script/script.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,19 @@ world = {
5454
chunks: [],
5555
allActiveChunks: [],
5656
allDeadChunks: [],
57-
getBlockId: function() {
57+
getBlockId: function(height) {
58+
if (height > 1)
59+
return 2;
60+
else
61+
return 12;
62+
63+
/*
5864
var candidates = [56,1,1,1,1,1,1,1,1,1,1,1,14,15,16,21,14,15,16,1,1,73];
5965
let a = Math.random()*candidates.length;
6066
if ((a < 1) && Math.random() < 0.99)
6167
a = Math.random()*candidates.length;
6268
return candidates[a|0];
69+
*/
6370
},
6471
addChunk: function(x,z) {
6572
let origin = {x:x*16-8, z:z*16-8};
@@ -76,7 +83,8 @@ world = {
7683
this.allActiveChunks.push(chunk);
7784
for (var i = 0; i < 16; i++) {
7885
for (var j = 0; j < 16; j++) {
79-
blocks.setBlock(j-8+chunk.position.x,-3+getHeightAt(chunk.position.x+j, chunk.position.z+i)|0, i-8+chunk.position.z, this.getBlockId());
86+
let ht = -2+getHeightAt(chunk.position.x+j, chunk.position.z+i)|0
87+
blocks.setBlock(j-8+chunk.position.x, ht, i-8+chunk.position.z, this.getBlockId(ht));
8088
let block = blocks.blocks[blocks.blocks.length-1];
8189
block.position.x -= chunk.position.x;
8290
block.position.z -= chunk.position.z;

0 commit comments

Comments
 (0)