mirror of
https://github.com/tpawstdio/skyscraperrising.git
synced 2025-05-05 14:14:50 -04:00
Added quarter_income signal
- Removed daily income option - Added quarter_income signal to game data
This commit is contained in:
parent
188400e30a
commit
8fd498367b
7 changed files with 55 additions and 25 deletions
|
@ -17,7 +17,7 @@ _global_script_class_icons={
|
|||
|
||||
config/name="Skyscraper Rising"
|
||||
run/main_scene="res://src/world.tscn"
|
||||
config/icon="res://icon.png"
|
||||
config/icon="res://start.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
|
|
|
@ -7,3 +7,5 @@ var prev_quarter: int
|
|||
var quarter: int = 1
|
||||
var population: int = 0
|
||||
enum GameSpeed { SLOW, MEDIUM, FAST }
|
||||
|
||||
signal quarter_income
|
||||
|
|
|
@ -1,47 +1,33 @@
|
|||
extends Node2D
|
||||
|
||||
enum IncomeFrequency { ONE_TIME, QUARTERLY, DAILY }
|
||||
enum IncomeFrequency { ONE_TIME, QUARTERLY }
|
||||
|
||||
export var room_cost: int = 10000
|
||||
export var room_income: int
|
||||
export var room_expense: int
|
||||
export var room_capacity: int
|
||||
export var is_rentable: bool
|
||||
export(IncomeFrequency) var income_frequency = IncomeFrequency.DAILY
|
||||
export(IncomeFrequency) var income_frequency = IncomeFrequency.QUARTERLY
|
||||
|
||||
var rent: Timer
|
||||
var is_vacant: bool
|
||||
var num_of_tenants: int
|
||||
var is_full: bool
|
||||
|
||||
func _ready():
|
||||
|
||||
match income_frequency:
|
||||
# TODO: how long should a day be?
|
||||
IncomeFrequency.DAILY:
|
||||
rent.wait_time = 1
|
||||
IncomeFrequency.QUARTERLY:
|
||||
rent.wait_time = 5
|
||||
GameData.connect("quarter_income", self, "_get_quarter_income")
|
||||
|
||||
# Once placed in-world, it'll substract from your budget
|
||||
if GameData.budget >= room_cost:
|
||||
GameData.budget = -room_cost
|
||||
GameData.budget -= room_cost
|
||||
|
||||
func _process(delta):
|
||||
|
||||
|
||||
# If the office is no longer vacant, start rent timer
|
||||
if is_rentable == true:
|
||||
if num_of_tenants >= room_capacity:
|
||||
is_vacant = false
|
||||
num_of_tenants += 1
|
||||
rent.start()
|
||||
else:
|
||||
rent.stop()
|
||||
|
||||
match income_frequency:
|
||||
IncomeFrequency.DAILY:
|
||||
# On timeout, pay the player and restart timer
|
||||
GameData.budget = room_income
|
||||
rent.start()
|
||||
IncomeFrequency.ONE_TIME:
|
||||
GameData.budget = room_income
|
||||
|
||||
func _get_quarter_income():
|
||||
GameData.budget += room_income
|
||||
|
|
|
@ -6,6 +6,7 @@ func _on_Quarters_timeout():
|
|||
GameData.quarter = 1
|
||||
GameData.year += 1
|
||||
else:
|
||||
GameData.emit_signal("quarter_income")
|
||||
GameData.quarter += 1
|
||||
|
||||
GameData.prev_quarter = GameData.quarter
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/world.gd" type="Script" id=1]
|
||||
[ext_resource path="res://src/gui.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://assets/office.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="World" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
|
@ -9,6 +10,12 @@ script = ExtResource( 1 )
|
|||
[node name="GUI" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Quarters" type="Timer" parent="."]
|
||||
wait_time = 5.0
|
||||
wait_time = 10.0
|
||||
autostart = true
|
||||
|
||||
[node name="Office" parent="." instance=ExtResource( 3 )]
|
||||
position = Vector2( 427.577, 274.653 )
|
||||
income_frequency = 1
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
[connection signal="timeout" from="Quarters" to="." method="_on_Quarters_timeout"]
|
||||
|
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
34
project/start.png.import
Normal file
34
project/start.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/start.png-e7f708061e705f5bb66856e98cf5d362.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://start.png"
|
||||
dest_files=[ "res://.import/start.png-e7f708061e705f5bb66856e98cf5d362.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
|
Loading…
Add table
Reference in a new issue