mirror of
https://github.com/tonytins/citylimits
synced 2025-06-25 09:24:44 -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
25
scripts/autoload/citydata.gd
Normal file
25
scripts/autoload/citydata.gd
Normal file
|
@ -0,0 +1,25 @@
|
|||
extends Node
|
||||
|
||||
var city_name: String
|
||||
|
||||
var budget: int
|
||||
var prev_budget: int
|
||||
|
||||
var res_tax: int
|
||||
var comm_tax: int
|
||||
var indust_tax: int
|
||||
|
||||
var fire_tax: int
|
||||
var police_tax: int
|
||||
var power_tax: int
|
||||
|
||||
func starting_budget(lev: int):
|
||||
|
||||
if lev == 1 or lev == 0:
|
||||
budget = 20000
|
||||
elif lev == 2:
|
||||
budget = 10000
|
||||
elif lev == 3:
|
||||
budget = 5000
|
||||
else:
|
||||
budget = NAN
|
7
scripts/gpanel.gd
Normal file
7
scripts/gpanel.gd
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends Panel
|
||||
|
||||
func _ready():
|
||||
$CityMenus/CityNameLbl.text = CityData.city_name
|
||||
|
||||
func _process(delta):
|
||||
$CityStatus/MoneyLbl.text = str(CityData.budget)
|
7
scripts/newgame.gd
Normal file
7
scripts/newgame.gd
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends Control
|
||||
|
||||
func _on_CreateBtn_pressed():
|
||||
var city_name = $CityNameEdit.text
|
||||
CityData.city_name = city_name
|
||||
|
||||
get_tree().change_scene("res://scenes/game.tscn")
|
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