diff --git a/dialog/cityplanner.json b/dialog/cityplanner.json new file mode 100644 index 0000000..b473ab0 --- /dev/null +++ b/dialog/cityplanner.json @@ -0,0 +1,6 @@ +{ + "1": { + "name": "Roll up your sleeves, Mayor!", + "text": "Welcome to City Limits! I'm Zack, and I'll be your city planner." + } +} \ No newline at end of file diff --git a/docs/.gdignore b/docs/.gdignore new file mode 100644 index 0000000..e69de29 diff --git a/scenes/Advise.tscn b/scenes/advisors/Advise.tscn similarity index 71% rename from scenes/Advise.tscn rename to scenes/advisors/Advise.tscn index f47465f..f7a5592 100644 --- a/scenes/Advise.tscn +++ b/scenes/advisors/Advise.tscn @@ -12,10 +12,9 @@ script = ExtResource( 2 ) __meta__ = { "_edit_use_anchors_": true } +dialogue_file = "res://dialog/cityplanner.json" 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="."] diff --git a/scenes/game.tscn b/scenes/game.tscn index bf75b9a..b2affd4 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,7 +1,7 @@ -[gd_scene load_steps=21 format=2] +[gd_scene load_steps=29 format=2] [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://scenes/advisors/Advise.tscn" type="PackedScene" id=2] [ext_resource path="res://scripts/city_status.gd" type="Script" id=3] [ext_resource path="res://sprites/ui/icpolhi.png" type="Texture" id=4] [ext_resource path="res://sprites/ui/iccom.png" type="Texture" id=5] @@ -20,6 +20,14 @@ [ext_resource path="res://sprites/ui/iccoalhi.png" type="Texture" id=18] [ext_resource path="res://sprites/ui/iccoal.png" type="Texture" id=19] [ext_resource path="res://scripts/game.gd" type="Script" id=20] +[ext_resource path="res://sprites/ui/demandg.png" type="Texture" id=21] +[ext_resource path="res://sprites/ui/icparkhi.png" type="Texture" id=22] +[ext_resource path="res://sprites/ui/icnuc.png" type="Texture" id=23] +[ext_resource path="res://sprites/ui/icpark.png" type="Texture" id=24] +[ext_resource path="res://sprites/ui/icnuchi.png" type="Texture" id=25] +[ext_resource path="res://sprites/ui/icseap.png" type="Texture" id=26] +[ext_resource path="res://sprites/ui/icseaphi.png" type="Texture" id=27] +[ext_resource path="res://sprites/ui/icstad.png" type="Texture" id=28] [node name="Game" type="Node2D"] script = ExtResource( 20 ) @@ -33,11 +41,13 @@ autostart = true [node name="Controls" type="CanvasLayer" parent="."] [node name="GUI" type="Control" parent="Controls"] -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 0.518677 +anchor_left = -0.000731155 +anchor_top = -0.000954026 +anchor_right = 0.999269 +anchor_bottom = 0.999044 +margin_left = -0.172424 margin_top = 2.77234 -margin_right = 0.518677 +margin_right = -0.172424 margin_bottom = 2.77234 __meta__ = { "_edit_use_anchors_": false @@ -45,88 +55,114 @@ __meta__ = { [node name="AdvsiorNotice" parent="Controls/GUI" instance=ExtResource( 2 )] -[node name="Status" type="Panel" parent="Controls/GUI"] -anchor_left = 0.540039 -anchor_top = 0.825 -anchor_right = 1.00781 -anchor_bottom = 1.01167 +[node name="StatusPanel" type="Panel" parent="Controls/GUI"] +anchor_left = 0.517578 +anchor_top = 0.830002 +anchor_right = 0.640625 +anchor_bottom = 1.0 __meta__ = { "_edit_use_anchors_": true } -[node name="Cotnainer" type="HSplitContainer" parent="Controls/GUI/Status"] +[node name="StatusCtr" type="CenterContainer" parent="Controls/GUI/StatusPanel"] anchor_right = 1.0 anchor_bottom = 1.0 -margin_left = 8.0 -margin_top = 4.0 -dragger_visibility = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="Status" type="VBoxContainer" parent="Controls/GUI/Status/Cotnainer"] +[node name="StatBox" type="HBoxContainer" parent="Controls/GUI/StatusPanel/StatusCtr"] +margin_left = 8.0 +margin_top = 25.0 +margin_right = 117.0 +margin_bottom = 75.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="InfoBox" type="VBoxContainer" parent="Controls/GUI/StatusPanel/StatusCtr/StatBox"] margin_right = 66.0 -margin_bottom = 108.0 +margin_bottom = 50.0 alignment = 1 script = ExtResource( 3 ) __meta__ = { "_edit_use_anchors_": false } -[node name="CityNameLbl" type="Label" parent="Controls/GUI/Status/Cotnainer/Status"] -margin_top = 29.0 +[node name="CityNameLbl" type="Label" parent="Controls/GUI/StatusPanel/StatusCtr/StatBox/InfoBox"] margin_right = 66.0 -margin_bottom = 43.0 +margin_bottom = 14.0 text = "City Name" align = 1 -[node name="YearLbl" type="Label" parent="Controls/GUI/Status/Cotnainer/Status"] -margin_top = 47.0 +[node name="YearLbl" type="Label" parent="Controls/GUI/StatusPanel/StatusCtr/StatBox/InfoBox"] +margin_top = 18.0 margin_right = 66.0 -margin_bottom = 61.0 -text = "2000" +margin_bottom = 32.0 +text = "Y1980" align = 1 -[node name="Money" type="HBoxContainer" parent="Controls/GUI/Status/Cotnainer/Status"] -margin_top = 65.0 +[node name="Money" type="HBoxContainer" parent="Controls/GUI/StatusPanel/StatusCtr/StatBox/InfoBox"] +margin_top = 36.0 margin_right = 66.0 -margin_bottom = 79.0 +margin_bottom = 50.0 alignment = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="CurrencyLbl" type="Label" parent="Controls/GUI/Status/Cotnainer/Status/Money"] +[node name="CurrencyLbl" type="Label" parent="Controls/GUI/StatusPanel/StatusCtr/StatBox/InfoBox/Money"] margin_left = 23.0 margin_right = 30.0 margin_bottom = 14.0 text = "ยง" -[node name="MoneyLbl" type="Label" parent="Controls/GUI/Status/Cotnainer/Status/Money"] +[node name="MoneyLbl" type="Label" parent="Controls/GUI/StatusPanel/StatusCtr/StatBox/InfoBox/Money"] margin_left = 34.0 margin_right = 42.0 margin_bottom = 14.0 text = "0" -[node name="Toolbar" type="Panel" parent="Controls/GUI/Status/Cotnainer"] -margin_left = 78.0 -margin_right = 471.0 -margin_bottom = 108.0 +[node name="RciBox" type="CenterContainer" parent="Controls/GUI/StatusPanel/StatusCtr/StatBox"] +margin_left = 70.0 +margin_right = 109.0 +margin_bottom = 50.0 __meta__ = { "_edit_use_anchors_": false } -[node name="Tabs" type="TabContainer" parent="Controls/GUI/Status/Cotnainer/Toolbar"] -anchor_left = 0.00118311 -anchor_top = 0.0191102 -anchor_right = 1.00118 -anchor_bottom = 1.01911 -margin_top = -4.76837e-07 +[node name="RciBtn" type="TextureButton" parent="Controls/GUI/StatusPanel/StatusCtr/StatBox/RciBox"] +margin_top = 1.0 +margin_right = 39.0 +margin_bottom = 48.0 +texture_normal = ExtResource( 21 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="BuyPanel" type="Panel" parent="Controls/GUI"] +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -370.0 +margin_top = -101.999 +margin_right = -0.000244141 +margin_bottom = 0.00109863 __meta__ = { "_edit_use_anchors_": true } -[node name="Zones" type="Tabs" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs"] +[node name="Tabs" type="TabContainer" parent="Controls/GUI/BuyPanel"] +anchor_left = 0.00144509 +anchor_top = -0.0294118 +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Zones" type="Tabs" parent="Controls/GUI/BuyPanel/Tabs"] anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 4.0 @@ -134,34 +170,34 @@ margin_top = 32.0 margin_right = -4.0 margin_bottom = -4.0 -[node name="ZoneCtr" type="HBoxContainer" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Zones"] +[node name="ZonesCtr" type="HBoxContainer" parent="Controls/GUI/BuyPanel/Tabs/Zones"] anchor_right = 1.0 anchor_bottom = 1.0 __meta__ = { "_edit_use_anchors_": false } -[node name="ResBtn" type="TextureButton" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Zones/ZoneCtr"] +[node name="ResBtn" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Zones/ZonesCtr"] margin_right = 34.0 -margin_bottom = 71.0 +margin_bottom = 69.0 texture_normal = ExtResource( 9 ) texture_pressed = ExtResource( 10 ) -[node name="ComBtn" type="TextureButton" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Zones/ZoneCtr"] +[node name="ComBtn" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Zones/ZonesCtr"] margin_left = 38.0 margin_right = 72.0 -margin_bottom = 71.0 +margin_bottom = 69.0 texture_normal = ExtResource( 5 ) texture_pressed = ExtResource( 8 ) -[node name="IndBtn" type="TextureButton" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Zones/ZoneCtr"] +[node name="IndBtn" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Zones/ZonesCtr"] margin_left = 76.0 margin_right = 110.0 -margin_bottom = 71.0 +margin_bottom = 69.0 texture_normal = ExtResource( 13 ) texture_pressed = ExtResource( 12 ) -[node name="Depts" type="Tabs" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs"] +[node name="Small" type="Tabs" parent="Controls/GUI/BuyPanel/Tabs"] visible = false anchor_right = 1.0 anchor_bottom = 1.0 @@ -170,48 +206,77 @@ margin_top = 32.0 margin_right = -4.0 margin_bottom = -4.0 -[node name="DepCtr" type="HBoxContainer" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Depts"] -anchor_left = -0.00119347 -anchor_right = 0.998807 +[node name="SmallCtr" type="HBoxContainer" parent="Controls/GUI/BuyPanel/Tabs/Small"] +anchor_right = 1.0 +anchor_bottom = 1.41667 +margin_bottom = -10.0 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="PoliceBtn" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Small/SmallCtr"] +margin_right = 34.0 +margin_bottom = 34.0 +texture_normal = ExtResource( 4 ) +texture_pressed = ExtResource( 16 ) + +[node name="FireBtn" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Small/SmallCtr"] +margin_left = 38.0 +margin_right = 72.0 +margin_bottom = 34.0 +texture_normal = ExtResource( 6 ) +texture_pressed = ExtResource( 11 ) + +[node name="ParkBtn" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Small/SmallCtr"] +margin_left = 76.0 +margin_right = 110.0 +margin_bottom = 34.0 +texture_normal = ExtResource( 24 ) +texture_pressed = ExtResource( 22 ) + +[node name="Large" type="Tabs" parent="Controls/GUI/BuyPanel/Tabs"] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 4.0 +margin_top = 32.0 +margin_right = -4.0 +margin_bottom = -4.0 + +[node name="LargeCtr" type="HBoxContainer" parent="Controls/GUI/BuyPanel/Tabs/Large"] +anchor_right = 1.0 anchor_bottom = 1.0 __meta__ = { "_edit_use_anchors_": false } -[node name="PoliceBtn" type="TextureButton" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Depts/DepCtr"] -margin_right = 34.0 -margin_bottom = 75.0 -texture_normal = ExtResource( 4 ) -texture_pressed = ExtResource( 16 ) +[node name="TextureButton" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Large/LargeCtr"] +margin_right = 42.0 +margin_bottom = 69.0 +texture_normal = ExtResource( 28 ) -[node name="FireBtn" type="TextureButton" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Depts/DepCtr"] -margin_left = 38.0 -margin_right = 72.0 -margin_bottom = 75.0 -texture_normal = ExtResource( 6 ) -texture_pressed = ExtResource( 11 ) +[node name="TextureButton2" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Large/LargeCtr"] +margin_left = 46.0 +margin_right = 88.0 +margin_bottom = 69.0 +texture_normal = ExtResource( 26 ) +texture_pressed = ExtResource( 27 ) -[node name="Power" type="Tabs" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs"] -visible = false -anchor_right = 1.0 -anchor_bottom = 1.0 -margin_left = 4.0 -margin_top = 32.0 -margin_right = -4.0 -margin_bottom = -4.0 +[node name="NuclearBtn" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Large/LargeCtr"] +margin_left = 92.0 +margin_right = 134.0 +margin_bottom = 69.0 +texture_normal = ExtResource( 23 ) +texture_pressed = ExtResource( 25 ) -[node name="PowerCtr" type="HBoxContainer" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Power"] -margin_right = 40.0 -margin_bottom = 40.0 - -[node name="CoalBtn" type="TextureButton" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Power/PowerCtr"] -margin_left = 75.7088 -margin_right = 117.709 -margin_bottom = 75.0 +[node name="CoalBtn" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Large/LargeCtr"] +margin_left = 138.0 +margin_right = 180.0 +margin_bottom = 69.0 texture_normal = ExtResource( 19 ) texture_pressed = ExtResource( 18 ) -[node name="Tools" type="Tabs" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs"] +[node name="Tools" type="Tabs" parent="Controls/GUI/BuyPanel/Tabs"] visible = false anchor_right = 1.0 anchor_bottom = 1.0 @@ -220,23 +285,23 @@ margin_top = 32.0 margin_right = -4.0 margin_bottom = -4.0 -[node name="ToolsCtr" type="HBoxContainer" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Tools"] -anchor_right = 5.875 -anchor_bottom = 2.45833 +[node name="ToolsCtr" type="HBoxContainer" parent="Controls/GUI/BuyPanel/Tabs/Tools"] +anchor_right = 1.33228 +anchor_bottom = 2.83333 __meta__ = { "_edit_use_anchors_": true } -[node name="InfoBtn" type="TextureButton" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Tools/ToolsCtr"] +[node name="InfoBtn" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Tools/ToolsCtr"] margin_right = 34.0 -margin_bottom = 59.0 +margin_bottom = 68.0 texture_normal = ExtResource( 15 ) texture_pressed = ExtResource( 14 ) -[node name="BulldozeBtn" type="TextureButton" parent="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Tools/ToolsCtr"] +[node name="BulldozeBtn" type="TextureButton" parent="Controls/GUI/BuyPanel/Tabs/Tools/ToolsCtr"] margin_left = 38.0 margin_right = 72.0 -margin_bottom = 59.0 +margin_bottom = 68.0 texture_normal = ExtResource( 17 ) texture_pressed = ExtResource( 7 ) __meta__ = { @@ -244,5 +309,5 @@ __meta__ = { } [connection signal="timeout" from="Quarters" to="." method="_on_Quarters_timeout"] -[connection signal="pressed" from="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Zones/ZoneCtr/ResBtn" to="Map" method="_on_ResBtn_pressed"] -[connection signal="pressed" from="Controls/GUI/Status/Cotnainer/Toolbar/Tabs/Power/PowerCtr/CoalBtn" to="Map" method="_on_CoalBtn_pressed"] +[connection signal="pressed" from="Controls/GUI/BuyPanel/Tabs/Zones/ZonesCtr/ResBtn" to="Map" method="_on_ResBtn_pressed"] +[connection signal="pressed" from="Controls/GUI/BuyPanel/Tabs/Large/LargeCtr/CoalBtn" to="Map" method="_on_CoalBtn_pressed"] diff --git a/scenes/zones/Coal.tscn b/scenes/zones/Coal.tscn index c06f618..dd94fbb 100644 --- a/scenes/zones/Coal.tscn +++ b/scenes/zones/Coal.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://sprites/coal.png" type="Texture" id=2] [sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 24.1295, 23.9406 ) +extents = Vector2( 32.2297, 31.8602 ) [sub_resource type="Animation" id=2] resource_name = "Animante" diff --git a/screenshot.png.import b/screenshot.png.import new file mode 100644 index 0000000..9116cdc --- /dev/null +++ b/screenshot.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/screenshot.png-024a21af5d37bf0f0dd0e2bccdd149d0.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://screenshot.png" +dest_files=[ "res://.import/screenshot.png-024a21af5d37bf0f0dd0e2bccdd149d0.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 diff --git a/scripts/Adviser.gd b/scripts/Adviser.gd index 1a8f8a0..5a1cf0d 100644 --- a/scripts/Adviser.gd +++ b/scripts/Adviser.gd @@ -1,19 +1,43 @@ extends AcceptDialog +export(String, FILE, "*.json") var dialogue_file +export var advisor_name: String +export var rank: String +export(Texture) var avatar +export var dialog = 0 + +var dialogue_keys = [] +var dialogue_name = "" +var dialogue_text = "" + 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 start_dialogue(): + index_dialogue() + description_label.text = dialogue_keys[dialog].text + self.window_title = dialogue_keys[dialog].name + + +func index_dialogue(): + var dialogue = load_dialogue(dialogue_file) + dialogue_keys.clear() + for key in dialogue: + dialogue_keys.append(dialogue[key]) + +func load_dialogue(file_path): + var file = File.new() + if file.file_exists(file_path): + file.open(file_path, file.READ) + var dialogue = parse_json(file.get_as_text()) + return dialogue func _ready(): - self.window_title = title - description_label.text = description + load_dialogue(dialogue_file) + self.show() + start_dialogue() avatar_texture.texture = avatar name_label.text = advisor_name rank_label.text = rank diff --git a/scripts/city_status.gd b/scripts/city_status.gd index 77fe757..c2af41f 100644 --- a/scripts/city_status.gd +++ b/scripts/city_status.gd @@ -9,4 +9,4 @@ func _ready(): func _process(delta): money.text = str(SimData.budget) - year.text = str(SimData.year) + year.text = "Y" + str(SimData.year)