Basic lakes

- Generate basic lakes within the empty spots generated by the terrian
- Ported over Micropolis' icons
This commit is contained in:
Anthony Wilcox 2019-11-29 12:55:48 -05:00
parent 2f7b47fa4d
commit 2c1a66e501
9 changed files with 74 additions and 8 deletions

Binary file not shown.

BIN
src/citylimits.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

24
src/graphics/grass.tres Normal file
View file

@ -0,0 +1,24 @@
[gd_resource type="TileSet" load_steps=2 format=2]
[ext_resource path="res://graphics/terrain_cl.png" type="Texture" id=1]
[resource]
0/name = "terrain_cl.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 16, 0, 16, 336 )
0/tile_mode = 1
0/autotile/bitmask_mode = 1
0/autotile/bitmask_flags = [ Vector2( 0, 0 ), 504, Vector2( 0, 1 ), 507, Vector2( 0, 2 ), 219, Vector2( 0, 3 ), 95, Vector2( 0, 4 ), 63, Vector2( 0, 5 ), 311, Vector2( 0, 6 ), 438, Vector2( 0, 7 ), 500, Vector2( 0, 8 ), 504, Vector2( 0, 9 ), 507, Vector2( 0, 10 ), 219, Vector2( 0, 11 ), 95, Vector2( 0, 12 ), 63, Vector2( 0, 13 ), 311, Vector2( 0, 14 ), 438, Vector2( 0, 15 ), 500, Vector2( 0, 16 ), 511, Vector2( 0, 17 ), 511, Vector2( 0, 18 ), 511, Vector2( 0, 19 ), 511, Vector2( 0, 20 ), 511 ]
0/autotile/icon_coordinate = Vector2( 0, 0 )
0/autotile/tile_size = Vector2( 16, 16 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shapes = [ ]
0/z_index = 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

24
src/graphics/water.tres Normal file
View file

@ -0,0 +1,24 @@
[gd_resource type="TileSet" load_steps=2 format=2]
[ext_resource path="res://graphics/terrain_cl.png" type="Texture" id=1]
[resource]
0/name = "terrain_cl.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 272, 16, 48 )
0/tile_mode = 1
0/autotile/bitmask_mode = 1
0/autotile/bitmask_flags = [ Vector2( 0, 0 ), 511, Vector2( 0, 1 ), 511, Vector2( 0, 2 ), 511 ]
0/autotile/icon_coordinate = Vector2( 0, 0 )
0/autotile/tile_size = Vector2( 16, 16 )
0/autotile/spacing = 0
0/autotile/occluder_map = [ ]
0/autotile/navpoly_map = [ ]
0/autotile/priority_map = [ ]
0/autotile/z_index_map = [ ]
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shapes = [ ]
0/z_index = 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -19,6 +19,11 @@ config/name="City Limits"
run/main_scene="res://world.tscn"
config/icon="res://icon.png"
[display]
window/stretch/mode="2d"
window/stretch/aspect="keep"
[rendering]
environment/default_environment="res://default_env.tres"

View file

@ -2,8 +2,7 @@ extends Node2D
var noise : OpenSimplexNoise
var map_size = Vector2(80, 60)
var grass_cap = 0.5
var road_caps = Vector2(0.3, 0.05)
var terrian_cap = 0.3
func _ready():
randomize()
@ -13,13 +12,21 @@ func _ready():
noise.period = 12
make_terrian_map()
make_water()
func make_terrian_map():
for x in map_size.x:
for y in map_size.y:
var a = noise.get_noise_2d(x, y)
if a < grass_cap:
if a < terrian_cap:
$Terrian.set_cell(x, y, 0)
$Terrian.update_bitmask_region(Vector2(0.0, 0.0), Vector2(map_size.x, map_size.y))
$Terrian.update_bitmask_region(Vector2(0.0, 0.0), Vector2(map_size.x, map_size.y))
func make_water():
for x in map_size.x:
for y in map_size.y:
if $Terrian.get_cell(x, y):
$Water.set_cell(x, y, 0)
$Water.update_bitmask_region(Vector2(0.0, 0.0), Vector2(map_size.x, map_size.y))

View file

@ -1,12 +1,18 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://world.gd" type="Script" id=1]
[ext_resource path="res://graphics/terrian.tres" type="TileSet" id=2]
[ext_resource path="res://graphics/water.tres" type="TileSet" id=2]
[ext_resource path="res://graphics/terrian.tres" type="TileSet" id=3]
[node name="Node2D" type="Node2D"]
script = ExtResource( 1 )
[node name="Terrian" type="TileMap" parent="."]
[node name="Water" type="TileMap" parent="."]
tile_set = ExtResource( 2 )
cell_size = Vector2( 16, 16 )
format = 1
[node name="Terrian" type="TileMap" parent="."]
tile_set = ExtResource( 3 )
cell_size = Vector2( 16, 16 )
format = 1