diff options
-rw-r--r-- | scenes/main.gd | 7 | ||||
-rw-r--r-- | scenes/main.tscn | 30 | ||||
-rw-r--r-- | scenes/score_window/score_window.gd | 51 |
3 files changed, 80 insertions, 8 deletions
diff --git a/scenes/main.gd b/scenes/main.gd index 3e32256..e8d4ea9 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -54,10 +54,11 @@ func _on_microgame_spawn_timer_timeout() -> void: window_instance.lose.connect(_on_microgame_lose) window_instance.ad_open.connect(_on_ad_open) - $"Score window (real)/Score window".net_worth.timesEquals(0.9) + $"Score window (real)/Score window".lose_money($"Score window (real)/Score window".net_worth.times(0.1)) func _on_ad_open(window: MicrogameWindow): - $"Score window (real)/Score window".net_worth.timesEquals(0.95) + $"Score window (real)/Score window".lose_money($"Score window (real)/Score window".net_worth.times(0.05)) + func _on_microgame_win(window: MicrogameWindow): print("yay") @@ -65,7 +66,7 @@ func _on_microgame_win(window: MicrogameWindow): func _on_microgame_lose(window: MicrogameWindow): print("noooooo") $LosingSoundEffect.play() - $"Score window (real)/Score window".net_worth.timesEquals(0.8) + $"Score window (real)/Score window".lose_money($"Score window (real)/Score window".net_worth.times(0.2)) func _on_fishin_win(fish_caught: Fishin.FishType) -> void: diff --git a/scenes/main.tscn b/scenes/main.tscn index 9191200..7b6d467 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=52 format=3 uid="uid://d06d1vihf2oqp"] +[gd_scene load_steps=53 format=3 uid="uid://d06d1vihf2oqp"] [ext_resource type="Texture2D" uid="uid://b03ygtrwha22g" path="res://taytay/IMG_5199.jpeg" id="1_o2s48"] [ext_resource type="Script" path="res://scenes/main.gd" id="1_y7a0r"] @@ -9,6 +9,7 @@ [ext_resource type="PackedScene" uid="uid://bbg7lnak6kup7" path="res://scenes/LegallyDistinctPaperclipAssistant/window.tscn" id="5_6agvn"] [ext_resource type="Script" path="res://scenes/score_window/score_window.gd" id="6_gvoxs"] [ext_resource type="Texture2D" uid="uid://dohsqvvi8y64h" path="res://UI/fish-spinning-ezgif.com-gif-to-sprite-converter.png" id="8_oj2tc"] +[ext_resource type="Script" path="res://libs/shake_pivot.gd" id="9_t2vd4"] [ext_resource type="PackedScene" uid="uid://c4s4pigu4pr48" path="res://scenes/microgames/fishin/node_2d.tscn" id="10_sx2ad"] [ext_resource type="AudioStream" uid="uid://di3mxkflh6a3o" path="res://funny_sounds/gamblecore.mp3" id="11_33353"] [ext_resource type="AudioStream" uid="uid://b45557wwianh8" path="res://funny_sounds/Super Mario 64 (Waaah) - Sound effect.mp3" id="12_xycxa"] @@ -306,7 +307,10 @@ stream = ExtResource("3_gatxj") visible = false [node name="Score window (real)" type="Window" parent="."] +position = Vector2i(0, 36) +size = Vector2i(1319, 300) visible = false +unresizable = true [node name="Score window" type="Node2D" parent="Score window (real)"] script = ExtResource("6_gvoxs") @@ -324,7 +328,28 @@ sprite_frames = SubResource("SpriteFrames_ke268") autoplay = "default" frame_progress = 0.387952 -[node name="Score" type="Label" parent="Score window (real)/Score window"] +[node name="ShakePivot" type="Node2D" parent="Score window (real)/Score window"] +visible = false +script = ExtResource("9_t2vd4") +NOISE_SHAKE_STRENGTH = 37.0 + +[node name="Label" type="Label" parent="Score window (real)/Score window/ShakePivot"] +offset_left = 24.45 +offset_top = 218.85 +offset_right = 448.45 +offset_bottom = 272.85 +theme = ExtResource("3_d7ku7") +theme_override_font_sizes/font_size = 53 +text = "+$100000" + +[node name="Timer" type="Timer" parent="Score window (real)/Score window/ShakePivot"] +wait_time = 0.5 + +[node name="ShakePivot2" type="Node2D" parent="Score window (real)/Score window"] +script = ExtResource("9_t2vd4") +NOISE_SHAKE_STRENGTH = 37.0 + +[node name="Score" type="Label" parent="Score window (real)/Score window/ShakePivot2"] offset_top = 2.0 offset_right = 1302.0 offset_bottom = 197.0 @@ -350,6 +375,7 @@ stream = ExtResource("12_xycxa") [connection signal="timeout" from="Microgame spawn timer" to="." method="_on_microgame_spawn_timer_timeout"] [connection signal="intro_finished" from="Clippette" to="." method="_on_clippette_intro_finished"] [connection signal="donezo" from="Score window (real)/Score window" to="." method="_on_score_window_donezo"] +[connection signal="timeout" from="Score window (real)/Score window/ShakePivot/Timer" to="Score window (real)/Score window" method="_on_timer_timeout"] [connection signal="buy" from="Stock ticker" to="Score window (real)/Score window" method="_on_stock_ticker_buy"] [connection signal="sell" from="Stock ticker" to="Score window (real)/Score window" method="_on_stock_ticker_sell"] [connection signal="fish_chosen" from="Fishin" to="Stock ticker" method="_on_fishin_fish_chosen"] diff --git a/scenes/score_window/score_window.gd b/scenes/score_window/score_window.gd index d6c465d..01b0647 100644 --- a/scenes/score_window/score_window.gd +++ b/scenes/score_window/score_window.gd @@ -4,6 +4,45 @@ 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) @@ -15,15 +54,21 @@ func _ready() -> void: # 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() + $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: - net_worth = net_worth.minus(amount) + lose_money(amount) func _on_stock_ticker_sell(amount: Variant) -> void: - net_worth = net_worth.plus(amount) + get_money(amount) + + +func _on_timer_timeout() -> void: + $ShakePivot.visible = false + + $ShakePivot/Timer.stop() |