Added advisor window

This commit is contained in:
Tony Bark 2021-05-18 04:10:16 -04:00
parent 71bdc3d971
commit 8435cab605
18 changed files with 301 additions and 147 deletions

View file

@ -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"

55
scenes/Advise.tscn Normal file
View file

@ -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

27
scenes/Map.tscn Normal file
View file

@ -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 )

71
scenes/Start.tscn Normal file
View file

@ -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"]

View file

@ -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 )

View file

@ -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"]

19
scripts/Adviser.gd Normal file
View file

@ -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

8
scripts/Game.gd Normal file
View file

@ -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()

8
scripts/StartGame.gd Normal file
View file

@ -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")

10
scripts/Status.gd Normal file
View file

@ -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)

View file

@ -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:

View file

@ -1,5 +1,5 @@
extends Node
signal quarter_income
signal one_time_income
signal pay_expense
signal game_speed

View file

@ -1,7 +0,0 @@
extends Panel
func _ready():
$citymenus/citynamelbl.text = CityData.city_name
func _process(delta):
$citystatus/moneylbl.text = str(CityData.budget)

View file

@ -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")

BIN
sprites/avatars/zc.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View file

@ -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