extends Node2D signal donezo var net_worth: Big func lose_money(value: Big): var strength if value.isGreaterThan(Big.new(2, 300)): strength = 2e300 else: strength = float(value.toString()) $ShakePivot2.shake_strength = strength $ShakePivot.shake_strength = strength $ShakePivot.visible = true $ShakePivot/Label.text = "-$%s" % value.toString() $ShakePivot/Label.add_theme_color_override("font_color", Color.RED) $ShakePivot.shake() net_worth.minusEquals(value) $ShakePivot/Timer.start() $ShakePivot2.shake() func get_money(value: Big): var strength if value.isGreaterThan(Big.new(2, 300)): strength = 2e300 else: strength = float(value.toString()) $ShakePivot2.shake_strength = strength $ShakePivot.shake_strength = strength $ShakePivot.visible = true $ShakePivot/Label.text = "+$%s" % value.toString() $ShakePivot/Label.add_theme_color_override("font_color", Color.WEB_GREEN) $ShakePivot.shake() net_worth.plusEquals(value) $ShakePivot/Timer.start() $ShakePivot2.shake() # 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: $ShakePivot2/Score.text = "Net worth: \n$%s" % net_worth.toString() if net_worth.isLessThan(Big.new(0)) or net_worth.toString()[0] == '-': donezo.emit() func _on_stock_ticker_buy(amount: Variant) -> void: lose_money(amount) func _on_stock_ticker_sell(amount: Variant) -> void: get_money(amount) func _on_timer_timeout() -> void: $ShakePivot.visible = false $ShakePivot/Timer.stop()