Skip to content

Commit

Permalink
Add free coins
Browse files Browse the repository at this point in the history
Added the option to get 1500 free coins for testing purposes.
  • Loading branch information
MadAvidCoder committed Dec 30, 2024
1 parent e4d6f1d commit 836dfb9
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 22 deletions.
35 changes: 33 additions & 2 deletions project/assets/scripts/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func _ready() -> void:
$Start.show()
$Start/Arrow_Left.hide()
$Start/Arrow_Right.hide()
$Start/Label.hide()
if Global.skin == 0:
get_tree().call_group("Frog", "show")
get_tree().call_group("Rabbit", "hide")
Expand All @@ -38,8 +39,18 @@ func _ready() -> void:
$Start/Arrow_Left.show()
$Start/Arrow_Right.show()
$Start/Username.text = Global.user
$Start/Coins.text = str(Global.coins)
$Start/Coins.text = str(Global.coins) + " Coins"
$High_Score.text = str(Global.high_score)
if not "rabbit" in Global.skins:
if not "squirrel" in Global.skins:
if Global.coins < 1500:
$Start/Label.show()
else:
if Global.coins < 500:
$Start/Label.show()
elif not "squirrel" in Global.skins:
if Global.coins < 1000:
$Start/Label.show()

func _process(delta: float) -> void:
if scroll:
Expand Down Expand Up @@ -137,7 +148,7 @@ func _start_game() -> void:
await Global.edit_user(Global.user, "coins", Global.coins)
await Global.edit_user(Global.user, "skins", ",".join(Global.skins))
$Start/Button.disabled = false
$Start/Coins.text = str(Global.coins)
$Start/Coins.text = str(Global.coins) + " Coins"
$Start/Button.text = "Play Game"
$Loading.hide()
$Loading/Circle.stop()
Expand Down Expand Up @@ -260,6 +271,16 @@ func _on_signin_authenticated() -> void:
$Signin._on_has_account_button_pressed()
$Loading.hide()
$Loading/Circle.stop()
if not "rabbit" in Global.skins:
if not "squirrel" in Global.skins:
if Global.coins < 1500:
$Start/Label.show()
else:
if Global.coins < 500:
$Start/Label.show()
elif not "squirrel" in Global.skins:
if Global.coins < 1000:
$Start/Label.show()

func _show_leaderboard() -> void:
$Loading.show()
Expand Down Expand Up @@ -313,3 +334,13 @@ func _close_leaderboard() -> void:
$Leaderboard/Row9/HighScore.text = "---"
$Leaderboard/Row10/Username.text = "Loading..."
$Leaderboard/Row10/HighScore.text = "---"

func _get_free() -> void:
$Loading.show()
$Loading/Circle.play()
Global.coins += 1500
$Start/Coins.text = str(Global.coins) + " Coins"
await Global.edit_user(Global.user, "coins", Global.coins)
$Loading.hide()
$Loading/Circle.stop()
$Start/Label.hide()
37 changes: 17 additions & 20 deletions project/main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -949,8 +949,6 @@ theme_override_font_sizes/font_size = 35
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 16
visible_ratio = 1.23077

[node name="VSeparator2" type="VSeparator" parent="Leaderboard/Row1"]
layout_mode = 2
Expand Down Expand Up @@ -994,8 +992,6 @@ theme_override_font_sizes/font_size = 35
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 16
visible_ratio = 1.23077

[node name="VSeparator2" type="VSeparator" parent="Leaderboard/Row2"]
layout_mode = 2
Expand Down Expand Up @@ -1039,8 +1035,6 @@ theme_override_font_sizes/font_size = 35
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 16
visible_ratio = 1.23077

[node name="VSeparator2" type="VSeparator" parent="Leaderboard/Row3"]
layout_mode = 2
Expand Down Expand Up @@ -1084,8 +1078,6 @@ theme_override_font_sizes/font_size = 35
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 16
visible_ratio = 1.23077

[node name="VSeparator2" type="VSeparator" parent="Leaderboard/Row4"]
layout_mode = 2
Expand Down Expand Up @@ -1129,8 +1121,6 @@ theme_override_font_sizes/font_size = 35
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 16
visible_ratio = 1.23077

[node name="VSeparator2" type="VSeparator" parent="Leaderboard/Row5"]
layout_mode = 2
Expand Down Expand Up @@ -1174,8 +1164,6 @@ theme_override_font_sizes/font_size = 35
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 16
visible_ratio = 1.23077

[node name="VSeparator2" type="VSeparator" parent="Leaderboard/Row6"]
layout_mode = 2
Expand Down Expand Up @@ -1219,8 +1207,6 @@ theme_override_font_sizes/font_size = 35
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 16
visible_ratio = 1.23077

[node name="VSeparator2" type="VSeparator" parent="Leaderboard/Row7"]
layout_mode = 2
Expand Down Expand Up @@ -1264,8 +1250,6 @@ theme_override_font_sizes/font_size = 35
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 16
visible_ratio = 1.23077

[node name="VSeparator2" type="VSeparator" parent="Leaderboard/Row8"]
layout_mode = 2
Expand Down Expand Up @@ -1309,8 +1293,6 @@ theme_override_font_sizes/font_size = 35
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 16
visible_ratio = 1.23077

[node name="VSeparator2" type="VSeparator" parent="Leaderboard/Row9"]
layout_mode = 2
Expand Down Expand Up @@ -1354,8 +1336,6 @@ theme_override_font_sizes/font_size = 35
text = "Loading..."
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 15
visible_ratio = 7.5

[node name="VSeparator2" type="VSeparator" parent="Leaderboard/Row10"]
layout_mode = 2
Expand Down Expand Up @@ -1501,6 +1481,22 @@ theme_override_font_sizes/font_size = 30
text_overrun_behavior = 1
metadata/_edit_use_anchors_ = true

[node name="Label" type="Label" parent="Start"]
offset_left = 11.0
offset_top = 7.0
offset_right = 201.0
offset_bottom = 33.0
theme_override_font_sizes/font_size = 18
text = "Testing for High Seas?"

[node name="LinkButton" type="LinkButton" parent="Start/Label"]
layout_mode = 0
offset_top = 22.0
offset_right = 134.0
offset_bottom = 62.0
theme_override_font_sizes/font_size = 18
text = "Get 1500 Coins!"

[node name="End" type="Node2D" parent="."]
visible = false
top_level = true
Expand Down Expand Up @@ -1632,5 +1628,6 @@ text = "Loading"
[connection signal="pressed" from="Start/Arrow_Right" to="." method="_on_arrow_right_pressed"]
[connection signal="pressed" from="Start/Button" to="." method="_start_game"]
[connection signal="pressed" from="Start/Leaderboard" to="." method="_show_leaderboard"]
[connection signal="pressed" from="Start/Label/LinkButton" to="." method="_get_free"]
[connection signal="pressed" from="End/Button" to="." method="_restart_game"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]

0 comments on commit 836dfb9

Please sign in to comment.