X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavedroid%2Fgame%2FWorldGen.java;h=4c9b9b23f68a1bfb823e44a1baffb087084a4b1b;hb=59d48c1b28c570755327a8fb0827fa57e7fd3914;hp=faacb252ba36fd2dfd06b8f5c748d44203742a3d;hpb=0a855ca3c1d0c84de41a928cc99fd8544a933015;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavedroid/game/WorldGen.java b/core/src/ru/deadsoftware/cavedroid/game/WorldGen.java index faacb25..4c9b9b2 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/WorldGen.java +++ b/core/src/ru/deadsoftware/cavedroid/game/WorldGen.java @@ -3,7 +3,7 @@ package ru.deadsoftware.cavedroid.game; import com.badlogic.gdx.math.RandomXS128; import com.badlogic.gdx.utils.TimeUtils; -public class WorldGen { +class WorldGen { private static RandomXS128 rand; private static long seed; @@ -23,23 +23,36 @@ public class WorldGen { res[0] = mid; for (int i = 1; i < width; i++) { t = rand.nextInt(7) - 3; - if (t > -3 && t < 3) t = 0; - else t /= Math.abs(t); + if (t > -3 && t < 3) { + t = 0; + } else { + t /= Math.abs(t); + } if (i > width - (max - min)) { - if (res[i - 1] + t < res[0]) t = Math.abs(t); - else if (res[i - 1] + t > res[0]) t = -Math.abs(t); + if (res[i - 1] + t < res[0]) { + t = Math.abs(t); + } else if (res[i - 1] + t > res[0]) { + t = -Math.abs(t); + } } res[i] = res[i - 1] + t; - if (res[i] < min) res[i] = min; - if (res[i] > max) res[i] = max; - if (i >= width / 2) { - bMap[i] = 1; - if (res[i] < 60) res[i] = 60; - } else { - bMap[i] = 0; + if (res[i] < min) { + res[i] = min; + } + if (res[i] > max) { + res[i] = max; } + bMap[i] = 0; +// if (i >= width / 2) { +// bMap[i] = 1; +// if (res[i] < 60) res[i] = 60; +// } else { +// bMap[i] = 0; +// } + } + if (res[0] < res[width - 1]) { + res[width - 1] = res[0]; } - if (res[0] < res[width - 1]) res[width - 1] = res[0]; return res; }