Title screen

- Title screen that lets you decide to the set the city name. Still figuring out the dropdown menu.
- Made city status script
This commit is contained in:
Anthony Foxclaw 2020-04-07 11:47:40 -04:00
parent b9fc048624
commit 9ba66410a4
7 changed files with 72 additions and 13 deletions

View file

@ -16,12 +16,12 @@ _global_script_class_icons={
[application]
config/name="City Limits"
run/main_scene="res://src/world.tscn"
run/main_scene="res://src/titlescreen.tscn"
config/icon="res://icon.png"
[autoload]
bank="*res://src/autoload/bank.gd"
CityData="*res://src/autoload/citydata.gd"
[display]

View file

@ -1,5 +1,7 @@
extends Node
var city_name: String
var budget: int
var prev_budget: int
@ -13,7 +15,7 @@ var power_tax: int
func starting_budget(lev: int):
if lev == 1:
if lev == 1 or lev == 0:
budget = 20000
elif lev == 2:
budget = 10000

7
src/gpanel.gd Normal file
View file

@ -0,0 +1,7 @@
extends Panel
func _ready():
$CityMenus/CityNameLbl.text = CityData.city_name
func _process(delta):
$CityStatus/MoneyLbl.text = str(CityData.budget)

View file

@ -1,4 +1,6 @@
[gd_scene format=2]
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/gpanel.gd" type="Script" id=2]
[node name="GUI" type="Control"]
anchor_right = 1.0
@ -10,6 +12,7 @@ __meta__ = {
[node name="GPanel" type="Panel" parent="."]
anchor_right = 1.0
margin_bottom = 23.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}

7
src/newgame.gd Normal file
View 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://src/world.tscn")

49
src/titlescreen.tscn Normal file
View file

@ -0,0 +1,49 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/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"]

View file

@ -4,17 +4,8 @@ var noise: OpenSimplexNoise
var map_size = Vector2(80, 60)
var terrian_cap = 0.3
func _process(delta):
$GUI/GPanel/CityStatus/MoneyLbl.text = str(bank.budget)
func _input(event):
pass
func _ready():
bank.starting_budget(1)
randomize()
noise = OpenSimplexNoise.new()
noise.seed = randi()