Continents shape improved.

This commit is contained in:
Duan Tao
2019-04-19 19:03:40 +08:00
parent babd29919a
commit c83a2ed73c

View File

@ -13,8 +13,8 @@ import kotlin.math.*
enum class MapType { enum class MapType {
Perlin, Perlin,
Default, Default,
Pangaea,
Continents, Continents,
Pangaea,
File File
} }
@ -26,7 +26,7 @@ class CelluarAutomataRandomMapGenerator(): SeedRandomMapGenerator() {
constructor(type: MapType): this() { constructor(type: MapType): this() {
mapType = type mapType = type
if (mapType != MapType.Default && mapType !=MapType.Pangaea) { if (mapType != MapType.Default && mapType !=MapType.Pangaea && mapType !=MapType.Continents) {
mapType = MapType.Default mapType = MapType.Default
} }
} }
@ -59,9 +59,8 @@ class CelluarAutomataRandomMapGenerator(): SeedRandomMapGenerator() {
} }
if (mapType == MapType.Continents) { //keep a ocean column in the middle if (mapType == MapType.Continents) { //keep a ocean column in the middle
for (y in -distance..distance) { for (y in -distance..distance) {
landscape[Vector2(0f, y.toFloat())] = TerrainType.Water landscape[Vector2((y/2).toFloat(), y.toFloat())] = TerrainType.Water
landscape[Vector2(1f, y.toFloat())] = TerrainType.Water landscape[Vector2((y/2+1).toFloat(), y.toFloat())] = TerrainType.Water
landscape[Vector2(-1f, y.toFloat())] = TerrainType.Water
} }
} }
} }