47 lines
1.8 KiB
GDScript
47 lines
1.8 KiB
GDScript
extends Control
|
|
|
|
func _ready():
|
|
GlobalVars.BusyTimeUpgrades = GlobalVars.LoadList("user://BusyTimeUpgrades")
|
|
|
|
if GlobalVars.BusyTimeUpgrades[0] == str(1):
|
|
get_node("BusyTimeUpgrades/Upgrade1").text = "Bought"
|
|
if GlobalVars.BusyTimeUpgrades[1] == str(1):
|
|
get_node("BusyTimeUpgrades/Upgrade2").text = "Bought"
|
|
if GlobalVars.BusyTimeUpgrades[2] == str(1):
|
|
get_node("BusyTimeUpgrades/Upgrade3").text = "Bought"
|
|
if GlobalVars.BusyTimeUpgrades[3] == str(1):
|
|
get_node("BusyTimeUpgrades/Upgrade4").text = "Bought"
|
|
if GlobalVars.BusyTimeUpgrades[4] == str(1):
|
|
get_node("BusyTimeUpgrades/Upgrade5").text = "Bought"
|
|
if GlobalVars.BusyTimeUpgrades[5] == str(1):
|
|
get_node("BusyTimeUpgrades/Upgrade6").text = "Bought"
|
|
|
|
|
|
func BusyTimeUpgrades(number: int):
|
|
if GlobalVars.Gold >= (50 * number) && get_node("BusyTimeUpgrades/Upgrade" + str(number)).text != "Bought":
|
|
GlobalVars.ChangeMoney(-50 * number)
|
|
GlobalVars.BusyTimeUpgrades[number - 1] = 1
|
|
get_node("BusyTimeUpgrades/Upgrade" + str(number)).text = "Bought"
|
|
GlobalVars.SaveSingle(GlobalVars.Gold, "user://Money")
|
|
GlobalVars.SaveList(GlobalVars.BusyTimeUpgrades, "user://BusyTimeUpgrades")
|
|
|
|
func BuyHelmet():
|
|
if GlobalVars.Gold >= 100:
|
|
GlobalVars.HelmetOwned[randi_range(0, GlobalVars.HelmetOwned.size() - 1)] = 1
|
|
GlobalVars.ChangeMoney(-100)
|
|
GlobalVars.SaveSingle(GlobalVars.Gold, "user://Money")
|
|
GlobalVars.SaveItems()
|
|
|
|
func BuyWeapon():
|
|
if GlobalVars.Gold >= 100:
|
|
GlobalVars.WeaponsOwned[randi_range(0, GlobalVars.WeaponsOwned.size() - 1)] = 1
|
|
GlobalVars.ChangeMoney(-100)
|
|
GlobalVars.SaveSingle(GlobalVars.Gold, "user://Money")
|
|
GlobalVars.SaveItems()
|
|
|
|
func BuyArmour():
|
|
if GlobalVars.Gold >= 100:
|
|
GlobalVars.ArmourOwned[randi_range(0, GlobalVars.ArmourOwned.size() - 1)] = 1
|
|
GlobalVars.ChangeMoney(-100)
|
|
GlobalVars.SaveSingle(GlobalVars.Gold, "user://Money")
|
|
GlobalVars.SaveItems()
|