mirror of
https://github.com/tonytins/citylimits
synced 2025-06-26 01:44:42 -04:00
New(ish) icon
- Reorganized project directories
This commit is contained in:
parent
29c7fa4502
commit
f5c7355d5a
111 changed files with 167 additions and 158 deletions
33
scripts/world.gd
Normal file
33
scripts/world.gd
Normal file
|
@ -0,0 +1,33 @@
|
|||
extends Node
|
||||
|
||||
var noise: OpenSimplexNoise
|
||||
var map_size = Vector2(80, 60)
|
||||
var terrian_cap = 0.3
|
||||
|
||||
func _ready():
|
||||
|
||||
randomize()
|
||||
noise = OpenSimplexNoise.new()
|
||||
noise.seed = randi()
|
||||
noise.octaves = 1.5
|
||||
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 < terrian_cap:
|
||||
$Terrian.set_cell(x, y, 0)
|
||||
|
||||
$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))
|
Loading…
Add table
Add a link
Reference in a new issue