diff --git a/project/assets/office.tscn b/project/assets/office.tscn index d513d36..f9058dc 100644 --- a/project/assets/office.tscn +++ b/project/assets/office.tscn @@ -4,3 +4,7 @@ [node name="Office" type="Node2D"] script = ExtResource( 1 ) + +[node name="Rent" type="Timer" parent="."] +wait_time = 5.0 +[connection signal="timeout" from="Rent" to="." method="_on_Rent_timeout"] diff --git a/project/project.godot b/project/project.godot index b2c69b0..6433bbe 100644 --- a/project/project.godot +++ b/project/project.godot @@ -23,9 +23,15 @@ config/icon="res://icon.png" TowerData="*res://src/autoload/twrdata.gd" +[display] + +window/stretch/mode="viewport" +window/stretch/aspect="keep" + [rendering] quality/driver/driver_name="GLES2" +quality/2d/gles2_use_nvidia_rect_flicker_workaround=true vram_compression/import_etc=true vram_compression/import_etc2=false environment/default_environment="res://default_env.tres" diff --git a/project/src/office.gd b/project/src/office.gd index 0844bc7..72ae48a 100644 --- a/project/src/office.gd +++ b/project/src/office.gd @@ -1,9 +1,26 @@ extends Node2D const OFFICE_PRICE = 1000 +const OFFICE_INCOME = 500 const MAINTANCE_COST = 350 +export var is_vacant: bool = true + func _ready(): # Once placed in-world, it'll substract from your budget if TowerData.budget >= OFFICE_PRICE: TowerData.budget = -OFFICE_PRICE + + +func _process(delta): + + # If the office is no longer vacant, start rent timer + if is_vacant == false: + $Rent.start() + else: + $Rent.stop() + +func _on_Rent_timeout(): + # On timeout, pay the player and restart timer + TowerData.budget = OFFICE_INCOME + $Rent.start()