DEADSOFTWARE

More blocks, trees
authorfred-boy <fred-boy@protonmail.com>
Thu, 12 Apr 2018 12:08:38 +0000 (19:08 +0700)
committerfred-boy <fred-boy@protonmail.com>
Thu, 12 Apr 2018 12:08:38 +0000 (19:08 +0700)
android/assets/terrain.png
core/src/ru/deadsoftware/cavecraft/Assets.java
core/src/ru/deadsoftware/cavecraft/Items.java
core/src/ru/deadsoftware/cavecraft/game/WorldGen.java

index 821b3e37a80a41caa072e27b032627aecd9c14b1..11be603c04fcd1a53fa7ce91fa8363cd4ae2a20f 100644 (file)
Binary files a/android/assets/terrain.png and b/android/assets/terrain.png differ
index 9d06345da9848da026bf0c9bd46d1f40382a8f18..6a99f1d3a60a34fab05ad670b5caf81418193115 100644 (file)
@@ -9,7 +9,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
 
 public class Assets {
 
-    public static final int BLOCK_TEXTURES = 9;
+    public static final int BLOCK_TEXTURES = 18;
 
     public static BitmapFont minecraftFont;
 
index 2b2474158bb40582a736230d7e756c18477a7a6d..001ac291667a69a55431b1a82f33038a6e3f49dd 100644 (file)
@@ -7,7 +7,7 @@ public class Items {
 
     public static ArrayMap<String, Block> BLOCKS = new ArrayMap<String, Block>();
 
-    public static void load() {
+    public static void loadBlocks() {
         BLOCKS.put("none", null);
         BLOCKS.put("stone", new Block(0,0,16,16,Assets.blockTextures[0]));
         BLOCKS.put("grass", new Block(0,0,16,16,Assets.blockTextures[1]));
@@ -18,6 +18,19 @@ public class Items {
         BLOCKS.put("bedrock", new Block(0,0,16,16,Assets.blockTextures[6]));
         BLOCKS.put("water", new Block(0,0,16,16,Assets.blockTextures[7],false,true));
         BLOCKS.put("lava", new Block(0,0,16,16,Assets.blockTextures[8],false,true));
+        BLOCKS.put("sand", new Block(0,0,16,16,Assets.blockTextures[9]));
+        BLOCKS.put("gravel", new Block(0,0,16,16,Assets.blockTextures[10]));
+        BLOCKS.put("gold_ore", new Block(0,0,16,16,Assets.blockTextures[11]));
+        BLOCKS.put("iron_ore", new Block(0,0,16,16,Assets.blockTextures[12]));
+        BLOCKS.put("coal_ore", new Block(0,0,16,16,Assets.blockTextures[13]));
+        BLOCKS.put("log", new Block(0,0,16,16,Assets.blockTextures[14]));
+        BLOCKS.put("leaves", new Block(0,0,16,16,Assets.blockTextures[15]));
+        BLOCKS.put("sponge", new Block(0,0,16,16,Assets.blockTextures[16]));
+        BLOCKS.put("glass", new Block(0,0,16,16,Assets.blockTextures[17]));
+    }
+
+    public static void load() {
+        loadBlocks();
     }
 
 }
index 6c09cf697bc908f6d69790d5fc68f66c7a92100a..d4635fd158f989307afa57ecd1127fbb94b0dcc6 100644 (file)
@@ -29,6 +29,26 @@ public class WorldGen {
         return res;
     }
 
+    private static void genOak(int x, int y) {
+        backMap[x][y] = 15;
+        backMap[x][y-1] = 15;
+        backMap[x][y-2] = 15;
+        backMap[x][y-3] = 15;
+        backMap[x][y-4] = 16;
+        backMap[x][y-5] = 16;
+        backMap[x-1][y-3] = 16;
+        backMap[x-1][y-4] = 16;
+        backMap[x+1][y-3] = 16;
+        backMap[x+1][y-4] = 16;
+        foreMap[x][y-3] = 16;
+        foreMap[x][y-4] = 16;
+        foreMap[x][y-5] = 16;
+        foreMap[x-1][y-3] = 16;
+        foreMap[x-1][y-4] = 16;
+        foreMap[x+1][y-3] = 16;
+        foreMap[x+1][y-4] = 16;
+    }
+
     static void genWorld(int width, int height) {
         genWorld(width, height, TimeUtils.millis());
     }
@@ -57,12 +77,13 @@ public class WorldGen {
                     backMap[x][y] = 7;
                 }
             }
-            for (int y = height/2; y<height- hMap[x]; y++) {
+            for (int y = height/4*3; y<height- hMap[x]; y++) {
                 if (foreMap[x][y]==0){
                     foreMap[x][y] = 8;
                     backMap[x][y] = 8;
                 }
             }
+            if (x>2 && x<width-2 && rand.nextInt(100)<5) genOak(x,height-hMap[x]-1);
         }
     }