aboutsummaryrefslogtreecommitdiff
path: root/lib/base_buyable.gd
diff options
context:
space:
mode:
authorjuneflow <63904206+juneflow@users.noreply.github.com>2020-04-18 19:52:21 +0200
committerjuneflow <63904206+juneflow@users.noreply.github.com>2020-04-18 19:52:21 +0200
commitc5d0c875e1e622fe897390ab745b283756fc3336 (patch)
treebadddb47ae93ae6da7accf123a26b19b53de8f8a /lib/base_buyable.gd
parent255475d35b954d442a79fd937dfaf395204cf639 (diff)
parentc94bcec15175b363057c9701481512b6d9b9dfdf (diff)
downloadLDJam46-c5d0c875e1e622fe897390ab745b283756fc3336.tar.gz
LDJam46-c5d0c875e1e622fe897390ab745b283756fc3336.tar.bz2
LDJam46-c5d0c875e1e622fe897390ab745b283756fc3336.zip
Merge branch 'master' of https://github.com/romangraef/LDJam46
Diffstat (limited to 'lib/base_buyable.gd')
-rw-r--r--lib/base_buyable.gd12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/base_buyable.gd b/lib/base_buyable.gd
new file mode 100644
index 0000000..db1a0e0
--- /dev/null
+++ b/lib/base_buyable.gd
@@ -0,0 +1,12 @@
+extends Area2D
+class_name BaseBuyable
+
+
+func _input_event(viewport, event, shape_idx):
+ # todo RMB max
+
+ if event is InputEventMouseButton and event.button_index == BUTTON_LEFT and event.is_pressed():
+ var parent = get_parent()
+ if SaveState.bitcoin >= parent.get_cost():
+ SaveState.bitcoin -= parent.get_cost()
+ parent._bought()