X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavecraft%2Fgame%2FWorldGen.java;h=84f0ae1b7591fe64d52368e6f3bc9019223186c9;hb=2d94431f674b2b604e03f32c9de4cf91c7fa715b;hp=96aedf3be559de55122d66030c3c0d6a0c4ee84d;hpb=226f349b0fcb10ca5b7d540ae632c8b7a6600439;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavecraft/game/WorldGen.java b/core/src/ru/deadsoftware/cavecraft/game/WorldGen.java index 96aedf3..84f0ae1 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/WorldGen.java +++ b/core/src/ru/deadsoftware/cavecraft/game/WorldGen.java @@ -1,18 +1,37 @@ package ru.deadsoftware.cavecraft.game; +import com.badlogic.gdx.math.RandomXS128; +import com.badlogic.gdx.utils.TimeUtils; + public class WorldGen { private static int[][] foreMap, backMap; + private static int[] noise; + + static int[] genNoise(int width, int mid, int min, int max) { + RandomXS128 rand = new RandomXS128(TimeUtils.millis()); + int[] res = new int[width]; + int t; + res[0] = mid; + for (int i=1; imax) res[i] = max; + } + return res; + } static void genWorld(int width, int height) { foreMap = new int[width][height]; backMap = new int[width][height]; + noise = genNoise(width, height/2, 1, height); for (int x=0; x