blob: 76fb98396af5ecfe44f95d19973574974ca7836c (
plain)
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 Node2D
signal donezo
var net_worth: Big
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
net_worth = Big.new(1000)
var window = get_window()
window.position = Vector2(450, 360)
window.size = Vector2(1319, 300)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
$Score.text = "Net worth: \n$%s" % net_worth.toString()
if net_worth.isLessThan(Big.new(0)):
donezo.emit()
func _on_stock_ticker_buy(amount: Variant) -> void:
net_worth = net_worth.minus(amount)
func _on_stock_ticker_sell(amount: Variant) -> void:
net_worth = net_worth.plus(amount)
|