school-game/godot/BudgetMenu.gd

20 lines
688 B
GDScript

extends Control
@onready var player_vars = get_node("/root/PlayerVariables")
@onready var game_time = get_node("/root/GameTimer")
@onready var finances = get_node("/root/Finances")
var estimate_month
# Called when the node enters the scene tree for the first time.
func _ready():
game_time.connect("heartbeat", Callable(self, "_on_heartbeat"))
func _on_heartbeat():
estimate_month = player_vars.pupils_income - player_vars.operating_costs - player_vars.salary_cost
$BuildingCostNumber.text = str(player_vars.operating_costs)
$TeacherCostNumber.text = str(player_vars.salary_cost)
$PupilIncomeNumber.text = str(player_vars.pupils_income)
$TotalNumber.text = str(estimate_month)