forked from lastleon/Beerventures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShop.gd
29 lines (23 loc) · 774 Bytes
/
Shop.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
extends Control
var health_cost = 10
var dagger_cost = 30
func _on_buy_dagger_pressed():
var config = Global.get_current_config()
if int(config["PLAYER_STATS"]["MONEY"]) >= dagger_cost:
if Global.add_item("bat"):
Global.add_money(-dagger_cost)
print("Bat added!")
else:
print("You already own this item...")
else:
print("OOOOOF, ya fuckin' broke, boi")
func _on_buy_health_pressed():
var config = Global.get_current_config()
if int(config["PLAYER_STATS"]["MONEY"]) >= health_cost:
Global.add_money(-health_cost)
Global.add_health(5)
print("New health: " + Global.get_current_config()["PLAYER_STATS"]["LIFE"])
else:
print("OOOOOF, ya fuckin' broke, boi")
func _on_return_button_pressed():
get_tree().change_scene("res://TitleScreen.tscn")