diff --git a/project.godot b/project.godot index 347fd8b..f74a315 100644 --- a/project.godot +++ b/project.godot @@ -15,7 +15,7 @@ _global_script_class_icons={ [application] config/name="City Limits" -run/main_scene="res://scenes/game.tscn" +run/main_scene="res://scenes/Start.tscn" config/icon="res://icon.png" config/windows_native_icon="res://icon.ico" diff --git a/scenes/Advise.tscn b/scenes/Advise.tscn new file mode 100644 index 0000000..f47465f --- /dev/null +++ b/scenes/Advise.tscn @@ -0,0 +1,55 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://sprites/avatars/zc.png" type="Texture" id=1] +[ext_resource path="res://scripts/Adviser.gd" type="Script" id=2] + +[node name="AdvsiorNotice" type="AcceptDialog"] +anchor_left = 0.293945 +anchor_top = 0.303333 +anchor_right = 0.706055 +anchor_bottom = 0.696667 +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": true +} +advisor_name = "Zack Casey" +rank = "City Planner" +title = "Welcome!" +description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis facilisis purus. Donec hendrerit lectus ex, eget feugiat felis egestas a. Proin ut ornare libero. Mauris non maximus sapien. Ut gravida, metus quis finibus suscipit, lacus ante lobortis libero, sed faucibus lacus nulla hendrerit magna. Nunc tempus purus vel lectus sollicitudin faucibus ut non magna. Pellentesque id varius eros, nec dapibus tellus. Sed vitae lacus dignissim, malesuada est eget, rhoncus velit." +avatar = ExtResource( 1 ) + +[node name="Container" type="HSplitContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 8.0 +margin_top = 8.0 +margin_right = -8.0 +margin_bottom = -36.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Advisor" type="VBoxContainer" parent="Container"] +margin_right = 100.0 +margin_bottom = 192.0 + +[node name="Avatar" type="TextureRect" parent="Container/Advisor"] +margin_right = 100.0 +rect_min_size = Vector2( 100, 0 ) + +[node name="RankLbl" type="Label" parent="Container/Advisor"] +margin_top = 4.0 +margin_right = 100.0 +margin_bottom = 18.0 +align = 1 + +[node name="NameLbl" type="Label" parent="Container/Advisor"] +margin_top = 22.0 +margin_right = 100.0 +margin_bottom = 36.0 +align = 1 + +[node name="DescriptionLbl" type="RichTextLabel" parent="Container"] +margin_left = 112.0 +margin_right = 406.0 +margin_bottom = 192.0 diff --git a/scenes/Map.tscn b/scenes/Map.tscn new file mode 100644 index 0000000..489cd15 --- /dev/null +++ b/scenes/Map.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=5 format=2] + +[ext_resource path="res://sprites/water.tres" type="TileSet" id=1] +[ext_resource path="res://scripts/Map.gd" type="Script" id=2] +[ext_resource path="res://sprites/terrian.tres" type="TileSet" id=4] +[ext_resource path="res://scripts/CameraMove.gd" type="Script" id=5] + +[node name="world" type="Node2D"] +script = ExtResource( 2 ) +__meta__ = { +"_edit_lock_": true +} + +[node name="water" type="TileMap" parent="."] +tile_set = ExtResource( 1 ) +cell_size = Vector2( 16, 16 ) +format = 1 + +[node name="terrian" type="TileMap" parent="."] +tile_set = ExtResource( 4 ) +cell_size = Vector2( 16, 16 ) +format = 1 + +[node name="Camera2D" type="Camera2D" parent="."] +position = Vector2( 512, 304 ) +current = true +script = ExtResource( 5 ) diff --git a/scenes/Start.tscn b/scenes/Start.tscn new file mode 100644 index 0000000..7d23b84 --- /dev/null +++ b/scenes/Start.tscn @@ -0,0 +1,71 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://scripts/StartGame.gd" type="Script" id=1] +[ext_resource path="res://scenes/Map.tscn" type="PackedScene" id=2] + +[node name="SartMenu" type="Node"] + +[node name="World" parent="." instance=ExtResource( 2 )] + +[node name="Controls" type="CanvasLayer" parent="."] + +[node name="Start" type="Panel" parent="Controls"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -142.0 +margin_top = -76.0 +margin_right = 130.0 +margin_bottom = 70.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Container" type="VBoxContainer" parent="Controls/Start"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 24.0 +margin_top = 28.0 +margin_right = -29.0 +margin_bottom = -28.0 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Label" type="Label" parent="Controls/Start/Container"] +margin_right = 219.0 +margin_bottom = 14.0 +text = "Welcome to City Limits!" +align = 1 + +[node name="CityNameEdit" type="LineEdit" parent="Controls/Start/Container"] +margin_top = 18.0 +margin_right = 219.0 +margin_bottom = 42.0 +text = "Furtropolis" +align = 1 +caret_blink = true +caret_blink_speed = 0.5 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="BudgetMenu" type="MenuButton" parent="Controls/Start/Container"] +margin_top = 46.0 +margin_right = 219.0 +margin_bottom = 66.0 +text = "Starting Budget" +items = [ "20000", null, 0, false, false, 0, 0, null, "", false, "10000", null, 0, false, false, 1, 0, null, "", false, "500", null, 0, false, false, 2, 0, null, "", false ] +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="CreateBtn" type="Button" parent="Controls/Start/Container"] +margin_top = 70.0 +margin_right = 219.0 +margin_bottom = 90.0 +text = "Create" + +[connection signal="pressed" from="Controls/Start/Container/CreateBtn" to="Controls/Start" method="_on_CreateBtn_pressed"] diff --git a/scenes/game.tscn b/scenes/game.tscn index f31dcd4..01593eb 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,112 +1,96 @@ [gd_scene load_steps=7 format=2] -[ext_resource path="res://sprites/water.tres" type="TileSet" id=1] -[ext_resource path="res://scripts/gpanel.gd" type="Script" id=2] -[ext_resource path="res://sprites/terrian.tres" type="TileSet" id=3] -[ext_resource path="res://scripts/world.gd" type="Script" id=4] -[ext_resource path="res://scripts/cameramovement.gd" type="Script" id=5] -[ext_resource path="res://scenes/Zone.tscn" type="PackedScene" id=6] +[ext_resource path="res://scenes/Map.tscn" type="PackedScene" id=1] +[ext_resource path="res://scenes/Advise.tscn" type="PackedScene" id=2] +[ext_resource path="res://scripts/Status.gd" type="Script" id=3] +[ext_resource path="res://scripts/Game.gd" type="Script" id=4] +[ext_resource path="res://sprites/police.png" type="Texture" id=5] +[ext_resource path="res://sprites/firestation.png" type="Texture" id=6] -[node name="game" type="Node"] - -[node name="world" type="Node2D" parent="."] +[node name="Game" type="Node"] script = ExtResource( 4 ) -__meta__ = { -"_edit_lock_": true -} -[node name="water" type="TileMap" parent="world"] -tile_set = ExtResource( 1 ) -cell_size = Vector2( 16, 16 ) -format = 1 +[node name="Map" parent="." instance=ExtResource( 1 )] -[node name="terrian" type="TileMap" parent="world"] -tile_set = ExtResource( 3 ) -cell_size = Vector2( 16, 16 ) -format = 1 +[node name="Controls" type="CanvasLayer" parent="."] -[node name="Camera2D" type="Camera2D" parent="world"] -position = Vector2( 512, 304 ) -current = true -script = ExtResource( 5 ) - -[node name="Resdenital" parent="world" instance=ExtResource( 6 )] -position = Vector2( 152.043, 336.414 ) - -[node name="ui" type="CanvasLayer" parent="."] - -[node name="base" type="Control" parent="ui"] +[node name="GUI" type="Control" parent="Controls"] anchor_right = 1.0 anchor_bottom = 1.0 __meta__ = { -"_edit_lock_": true, "_edit_use_anchors_": false } -[node name="gpanel" type="Panel" parent="ui/base"] -anchor_right = 1.0 -margin_bottom = 23.0 -script = ExtResource( 2 ) +[node name="AdvsiorNotice" parent="Controls/GUI" instance=ExtResource( 2 )] + +[node name="Status" type="Panel" parent="Controls/GUI"] +anchor_top = 0.883459 +anchor_right = 0.592773 +anchor_bottom = 1.00179 __meta__ = { -"_edit_use_anchors_": false +"_edit_use_anchors_": true } -[node name="citymenus" type="HBoxContainer" parent="ui/base/gpanel"] -anchor_top = 0.5 -anchor_bottom = 0.5 -margin_left = 3.0 -margin_top = -10.0 -margin_right = 166.0 -margin_bottom = 10.0 +[node name="Toolbar" type="HBoxContainer" parent="Controls/GUI/Status"] +anchor_left = 0.00823723 +anchor_top = 0.0704225 +anchor_right = 0.98682 +anchor_bottom = 1.0 __meta__ = { -"_edit_use_anchors_": false +"_edit_use_anchors_": true } -[node name="citynamelbl" type="Label" parent="ui/base/gpanel/citymenus"] -margin_top = 3.0 -margin_right = 66.0 -margin_bottom = 17.0 +[node name="Status" type="VBoxContainer" parent="Controls/GUI/Status/Toolbar"] +margin_right = 93.0 +margin_bottom = 66.0 +script = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="CityNameLbl" type="Label" parent="Controls/GUI/Status/Toolbar/Status"] +margin_right = 93.0 +margin_bottom = 14.0 text = "City Name" +align = 1 -[node name="gamespeed" type="MenuButton" parent="ui/base/gpanel/citymenus"] -margin_left = 70.0 -margin_right = 163.0 -margin_bottom = 20.0 +[node name="GameSpeed" type="MenuButton" parent="Controls/GUI/Status/Toolbar/Status"] +margin_top = 18.0 +margin_right = 93.0 +margin_bottom = 38.0 +focus_mode = 2 text = "Game Speed" items = [ "Slow", null, 0, false, false, 0, 0, null, "", false, "Medium", null, 0, false, false, 1, 0, null, "", false, "Fast", null, 0, false, false, 2, 0, null, "", false ] -[node name="citystatus" type="HBoxContainer" parent="ui/base/gpanel"] -anchor_left = 1.0 -anchor_top = 0.5 -anchor_right = 1.0 -anchor_bottom = 0.5 -margin_left = -276.0 -margin_top = -9.5 -margin_right = -4.0 -margin_bottom = 10.5 -alignment = 2 +[node name="Money" type="HBoxContainer" parent="Controls/GUI/Status/Toolbar/Status"] +margin_top = 42.0 +margin_right = 93.0 +margin_bottom = 56.0 +alignment = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="currencylbl" type="Label" parent="ui/base/gpanel/citystatus"] -margin_left = 252.0 -margin_top = 3.0 -margin_right = 259.0 -margin_bottom = 17.0 +[node name="CurrencyLbl" type="Label" parent="Controls/GUI/Status/Toolbar/Status/Money"] +margin_left = 36.0 +margin_right = 43.0 +margin_bottom = 14.0 text = "ยง" -[node name="moneylbl" type="Label" parent="ui/base/gpanel/citystatus"] -margin_left = 263.0 -margin_top = 3.0 -margin_right = 272.0 -margin_bottom = 17.0 +[node name="MoneyLbl" type="Label" parent="Controls/GUI/Status/Toolbar/Status/Money"] +margin_left = 47.0 +margin_right = 56.0 +margin_bottom = 14.0 text = "#" -[node name="debugbtn" type="Button" parent="ui/base/gpanel"] -visible = false -margin_left = 932.754 -margin_top = 563.202 -margin_right = 985.754 -margin_bottom = 583.202 -text = "Debug" +[node name="PoliceBtn" type="TextureButton" parent="Controls/GUI/Status/Toolbar"] +margin_left = 97.0 +margin_right = 145.0 +margin_bottom = 66.0 +texture_normal = ExtResource( 5 ) + +[node name="FireBtn" type="TextureButton" parent="Controls/GUI/Status/Toolbar"] +margin_left = 149.0 +margin_right = 197.0 +margin_bottom = 66.0 +texture_normal = ExtResource( 6 ) diff --git a/scenes/titlescreen.tscn b/scenes/titlescreen.tscn deleted file mode 100644 index 858fb1b..0000000 --- a/scenes/titlescreen.tscn +++ /dev/null @@ -1,50 +0,0 @@ -[gd_scene load_steps=2 format=2] - -[ext_resource path="res://scripts/newgame.gd" type="Script" id=1] - -[node name="SartMenu" type="Control"] -anchor_right = 1.0 -anchor_bottom = 1.0 -script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label" type="Label" parent="."] -margin_left = 312.0 -margin_top = 235.0 -margin_right = 601.0 -margin_bottom = 249.0 -text = "Welcome to City Limits!" -align = 1 - -[node name="CityNameEdit" type="LineEdit" parent="."] -margin_left = 312.0 -margin_top = 261.0 -margin_right = 601.0 -margin_bottom = 285.0 -text = "City Name" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="BudgetMenu" type="MenuButton" parent="."] -margin_left = 312.0 -margin_top = 294.0 -margin_right = 601.0 -margin_bottom = 314.0 -text = "Starting Budget" -items = [ "20000", null, 0, false, false, 0, 0, null, "", false, "10000", null, 0, false, false, 1, 0, null, "", false, "500", null, 0, false, false, 2, 0, null, "", false ] -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="CreateBtn" type="Button" parent="."] -margin_left = 312.0 -margin_top = 319.0 -margin_right = 601.0 -margin_bottom = 339.0 -text = "Create" - -[connection signal="pressed" from="CreateBtn" to="." method="_on_CreateBtn_pressed"] diff --git a/scripts/Adviser.gd b/scripts/Adviser.gd new file mode 100644 index 0000000..1a8f8a0 --- /dev/null +++ b/scripts/Adviser.gd @@ -0,0 +1,19 @@ +extends AcceptDialog + +onready var avatar_texture = $Container/Advisor/Avatar +onready var rank_label = $Container/Advisor/RankLbl +onready var name_label = $Container/Advisor/NameLbl +onready var description_label = $Container/DescriptionLbl + +export var advisor_name: String +export var rank: String +export var title: String +export(String, MULTILINE) var description +export(Texture) var avatar + +func _ready(): + self.window_title = title + description_label.text = description + avatar_texture.texture = avatar + name_label.text = advisor_name + rank_label.text = rank diff --git a/scripts/cameramovement.gd b/scripts/CameraMove.gd similarity index 100% rename from scripts/cameramovement.gd rename to scripts/CameraMove.gd diff --git a/scripts/Game.gd b/scripts/Game.gd new file mode 100644 index 0000000..3143aab --- /dev/null +++ b/scripts/Game.gd @@ -0,0 +1,8 @@ +extends Node + +onready var gui = $Controls/GUI +onready var advisor = $Controls/GUI/AdvsiorNotice + +# Called when the node enters the scene tree for the first time. +func _ready(): + advisor.show() diff --git a/scripts/world.gd b/scripts/Map.gd similarity index 100% rename from scripts/world.gd rename to scripts/Map.gd diff --git a/scripts/StartGame.gd b/scripts/StartGame.gd new file mode 100644 index 0000000..4dacb0c --- /dev/null +++ b/scripts/StartGame.gd @@ -0,0 +1,8 @@ +extends Panel + +onready var city_name = $Container/CityNameEdit.text + +func _on_CreateBtn_pressed(): + SimData.city_name = city_name + + get_tree().change_scene("res://scenes/Game.tscn") diff --git a/scripts/Status.gd b/scripts/Status.gd new file mode 100644 index 0000000..6bd9cd5 --- /dev/null +++ b/scripts/Status.gd @@ -0,0 +1,10 @@ +extends BoxContainer + +onready var city_name = $CityNameLbl +onready var money = $Money/MoneyLbl + +func _ready(): + city_name.text = SimData.city_name + +func _process(delta): + money.text = str(SimData.budget) diff --git a/scripts/autoload/SimData.gd b/scripts/autoload/SimData.gd index c214fbb..6043ecc 100644 --- a/scripts/autoload/SimData.gd +++ b/scripts/autoload/SimData.gd @@ -1,6 +1,6 @@ extends Node -var city_name: String = "Furtropolis" +var city_name: String var year: int = 1 var prev_quarter: int var quarter: int = 1 @@ -18,6 +18,8 @@ var fire_tax: int var police_tax: int var power_tax: int +enum GameSpeed {SLOW, MEDIUM, FAST} + func starting_budget(lev: int): if lev == 1 or lev == 0: diff --git a/scripts/autoload/SimEvents.gd b/scripts/autoload/SimEvents.gd index 010b39d..609c837 100644 --- a/scripts/autoload/SimEvents.gd +++ b/scripts/autoload/SimEvents.gd @@ -1,5 +1,5 @@ extends Node -signal quarter_income signal one_time_income signal pay_expense +signal game_speed diff --git a/scripts/gpanel.gd b/scripts/gpanel.gd deleted file mode 100644 index e3f942f..0000000 --- a/scripts/gpanel.gd +++ /dev/null @@ -1,7 +0,0 @@ -extends Panel - -func _ready(): - $citymenus/citynamelbl.text = CityData.city_name - -func _process(delta): - $citystatus/moneylbl.text = str(CityData.budget) diff --git a/scripts/newgame.gd b/scripts/newgame.gd deleted file mode 100644 index 8ff8bc3..0000000 --- a/scripts/newgame.gd +++ /dev/null @@ -1,7 +0,0 @@ -extends Control - -func _on_CreateBtn_pressed(): - var city_name = $CityNameEdit.text - CityData.city_name = city_name - - get_tree().change_scene("res://scenes/game.tscn") diff --git a/sprites/avatars/zc.png b/sprites/avatars/zc.png new file mode 100755 index 0000000..3124203 Binary files /dev/null and b/sprites/avatars/zc.png differ diff --git a/sprites/avatars/zc.png.import b/sprites/avatars/zc.png.import new file mode 100644 index 0000000..3758b98 --- /dev/null +++ b/sprites/avatars/zc.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/zc.png-c7ffa83bf28af8def63c79202632e383.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/avatars/zc.png" +dest_files=[ "res://.import/zc.png-c7ffa83bf28af8def63c79202632e383.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0