added selling cards and made shop items cheaper

This commit is contained in:
2024-03-31 19:32:00 +11:00
parent e84496dcf8
commit 05914a3c64
22 changed files with 354 additions and 413 deletions

View File

@ -0,0 +1,45 @@
class_name GameEndScreen extends PanelContainer
@export var box: PackedScene
@export var outcome_label: Label
@export var winrate_label: Label
@export var total_games_label: Label
@export var total_wins_label: Label
@export var total_losses_label: Label
@export var undefeated_enemies: VBoxContainer
func _ready() -> void:
var wins: int = Data.save_stats.twenty_game_history.count(true)
var games: int = Data.save_stats.twenty_game_history.size()
var winrate: int = int((float(wins) / float(games)) * 100.0)
winrate_label.text = "Your 20-game winrate is now: " + str(winrate) + "%!"
total_games_label.text = "Total games: " + str(Data.save_stats.wins + Data.save_stats.losses)
total_wins_label.text = "Total wins: " + str(Data.save_stats.wins)
total_losses_label.text = "Total losses: " + str(Data.save_stats.losses)
for wave_key: int in Game.stats.enemies_undefeated:
var spawned_box: EnemyBox = box.instantiate() as EnemyBox
undefeated_enemies.add_child(spawned_box)
spawned_box.set_wave(wave_key)
for enemy_key: Enemy in Game.stats.enemies_undefeated[wave_key]:
spawned_box.add_enemy_tag(enemy_key, Game.stats.enemies_undefeated[wave_key][enemy_key])
func set_outcome_message(message: String) -> void:
outcome_label.text = message
func _on_quit_button_pressed() -> void:
Game.scene_switch_main_menu()
queue_free()
func _on_play_button_pressed() -> void:
Game.setup()
Game.start()
queue_free()
func _on_button_mouse_entered() -> void:
$AudioStreamPlayer.play()

View File

@ -0,0 +1,93 @@
[gd_scene load_steps=5 format=3 uid="uid://ce0m8vbjbng6o"]
[ext_resource type="Script" path="res://Scenes/Menus/GameEndScreen/game_end_screen.gd" id="1_oa7nq"]
[ext_resource type="PackedScene" uid="uid://b5hp43bm07b8a" path="res://h_box_container.tscn" id="2_xm8em"]
[ext_resource type="AudioStream" uid="uid://cp6ph4ra7u5rk" path="res://Scenes/UI/drop_003.ogg" id="3_ro1yg"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_dram5"]
random_pitch = 1.1
streams_count = 1
stream_0/stream = ExtResource("3_ro1yg")
stream_0/weight = 1.0
[node name="GameEndScreen" type="PanelContainer" node_paths=PackedStringArray("outcome_label", "winrate_label", "total_games_label", "total_wins_label", "total_losses_label", "undefeated_enemies")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 150.0
offset_top = 100.0
offset_right = -150.0
offset_bottom = -100.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_oa7nq")
box = ExtResource("2_xm8em")
outcome_label = NodePath("VBoxContainer/Labels/OutcomeLabel")
winrate_label = NodePath("VBoxContainer/Labels/WinRateLabel")
total_games_label = NodePath("VBoxContainer/Labels/TotalGamesLabel")
total_wins_label = NodePath("VBoxContainer/Labels/TotalWinsLabel")
total_losses_label = NodePath("VBoxContainer/Labels/TotalLossesLabel")
undefeated_enemies = NodePath("VBoxContainer/UndefeatedEnemies")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
[node name="Labels" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
alignment = 1
[node name="OutcomeLabel" type="Label" parent="VBoxContainer/Labels"]
layout_mode = 2
text = "You WIN :3"
horizontal_alignment = 1
vertical_alignment = 1
[node name="WinRateLabel" type="Label" parent="VBoxContainer/Labels"]
layout_mode = 2
text = "Your winrate is now: 80%"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TotalGamesLabel" type="Label" parent="VBoxContainer/Labels"]
layout_mode = 2
text = "Total games played: 315"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TotalWinsLabel" type="Label" parent="VBoxContainer/Labels"]
layout_mode = 2
text = "Total wins"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TotalLossesLabel" type="Label" parent="VBoxContainer/Labels"]
layout_mode = 2
text = "Total losses"
horizontal_alignment = 1
vertical_alignment = 1
[node name="UndefeatedEnemies" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="Buttons" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
alignment = 2
[node name="PlayButton" type="Button" parent="VBoxContainer/Buttons"]
layout_mode = 2
text = "Play Again"
[node name="QuitButton" type="Button" parent="VBoxContainer/Buttons"]
layout_mode = 2
text = "Return to menu"
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = SubResource("AudioStreamRandomizer_dram5")
bus = &"SFX"
[connection signal="mouse_entered" from="VBoxContainer/Buttons/PlayButton" to="." method="_on_button_mouse_entered"]
[connection signal="pressed" from="VBoxContainer/Buttons/PlayButton" to="." method="_on_play_button_pressed"]
[connection signal="mouse_entered" from="VBoxContainer/Buttons/QuitButton" to="." method="_on_button_mouse_entered"]
[connection signal="pressed" from="VBoxContainer/Buttons/QuitButton" to="." method="_on_quit_button_pressed"]

View File

@ -58,6 +58,7 @@ func quit_game(confirmation: bool) -> void:
func _on_play_button_pressed() -> void:
Game.level = null
Game.scene_switch_to_singleplayer_lobby()
@ -67,6 +68,7 @@ func _on_options_button_pressed() -> void:
func _on_multiplayer_button_pressed() -> void:
Game.level = null
Game.scene_switch_to_multiplayer_lobby()

View File

@ -1,134 +0,0 @@
[gd_scene load_steps=5 format=3 uid="uid://dsydnch32qh2h"]
[ext_resource type="Script" path="res://Scripts/lost_game_screen.gd" id="1_1pne8"]
[ext_resource type="AudioStream" uid="uid://cp6ph4ra7u5rk" path="res://Scenes/UI/drop_003.ogg" id="3_v84an"]
[ext_resource type="PackedScene" uid="uid://b5hp43bm07b8a" path="res://h_box_container.tscn" id="3_ynscm"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_ddnd1"]
random_pitch = 1.1
streams_count = 1
stream_0/stream = ExtResource("3_v84an")
stream_0/weight = 1.0
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_1pne8")
box = ExtResource("3_ynscm")
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 0.745098)
[node name="Label" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -33.5
offset_top = 145.0
offset_right = 33.5
offset_bottom = 26.0
grow_horizontal = 2
text = "You Lost"
[node name="Label2" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -95.0
offset_top = 305.0
offset_right = 38.0
offset_bottom = 350.0
grow_horizontal = 2
text = "You Lost"
[node name="Label3" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -897.0
offset_top = 120.0
offset_right = -509.0
offset_bottom = 165.0
grow_horizontal = 2
text = "Total games played: 315"
[node name="Label4" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -901.0
offset_top = 178.0
offset_right = -513.0
offset_bottom = 223.0
grow_horizontal = 2
text = "Total wins"
[node name="Label5" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -874.0
offset_top = 239.0
offset_right = -486.0
offset_bottom = 284.0
grow_horizontal = 2
text = "Total losses"
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -274.0
offset_top = -20.0
offset_right = 274.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
[node name="RestartButton" type="Button" parent="HBoxContainer"]
layout_mode = 2
text = "Play Again"
[node name="QuitButton" type="Button" parent="HBoxContainer"]
layout_mode = 2
text = "Quit to main menu"
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = SubResource("AudioStreamRandomizer_ddnd1")
bus = &"SFX"
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -20.0
offset_top = -40.0
offset_right = 20.0
grow_horizontal = 2
grow_vertical = 0
[connection signal="mouse_entered" from="HBoxContainer/RestartButton" to="." method="_on_button_mouse_entered"]
[connection signal="pressed" from="HBoxContainer/RestartButton" to="." method="_on_restart_button_pressed"]
[connection signal="mouse_entered" from="HBoxContainer/QuitButton" to="." method="_on_button_mouse_entered"]
[connection signal="pressed" from="HBoxContainer/QuitButton" to="." method="_on_quit_button_pressed"]

View File

@ -13,7 +13,7 @@ streams_count = 1
stream_0/stream = ExtResource("6_6nu57")
stream_0/weight = 1.0
[node name="singleplayer_lobby" type="Control" node_paths=PackedStringArray("scoreboard", "loadout_editor", "chatbox")]
[node name="singleplayer_lobby" type="Control" node_paths=PackedStringArray("scoreboard", "loadout_editor", "chatbox", "seed_entry", "ready_button", "daily_button")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
@ -26,6 +26,9 @@ script = ExtResource("1_nd17k")
scoreboard = NodePath("Scoreboard")
loadout_editor = NodePath("Control")
chatbox = NodePath("Chatbox")
seed_entry = NodePath("LineEdit")
ready_button = NodePath("ReadyButton")
daily_button = NodePath("DailyButton")
[node name="Scoreboard" parent="." instance=ExtResource("1_423py")]
visible = false
@ -64,6 +67,28 @@ layout_mode = 1
stream = SubResource("AudioStreamRandomizer_g5har")
bus = &"SFX"
[node name="LineEdit" type="LineEdit" parent="."]
visible = false
layout_mode = 0
offset_right = 69.0625
offset_bottom = 23.0
placeholder_text = "seed"
[node name="DailyButton" type="Button" parent="."]
visible = false
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -276.0
offset_top = -40.0
grow_horizontal = 0
grow_vertical = 0
text = "Daily challenge"
[connection signal="mouse_entered" from="ReadyButton" to="." method="_on_button_mouse_entered"]
[connection signal="pressed" from="ReadyButton" to="Scoreboard" method="set_player_ready_state" binds= [1, true]]
[connection signal="pressed" from="ReadyButton" to="ReadyButton" method="set_visible" binds= [false]]
[connection signal="mouse_entered" from="DailyButton" to="." method="_on_button_mouse_entered"]
[connection signal="pressed" from="DailyButton" to="." method="_on_daily_button_pressed"]

View File

@ -1,134 +0,0 @@
[gd_scene load_steps=5 format=3 uid="uid://ce0m8vbjbng6o"]
[ext_resource type="Script" path="res://Scripts/won_game_screen.gd" id="1_oa7nq"]
[ext_resource type="PackedScene" uid="uid://b5hp43bm07b8a" path="res://h_box_container.tscn" id="2_xm8em"]
[ext_resource type="AudioStream" uid="uid://cp6ph4ra7u5rk" path="res://Scenes/UI/drop_003.ogg" id="3_ro1yg"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_dram5"]
random_pitch = 1.1
streams_count = 1
stream_0/stream = ExtResource("3_ro1yg")
stream_0/weight = 1.0
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_oa7nq")
box = ExtResource("2_xm8em")
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 0.745098)
[node name="Label" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -20.0
offset_top = 260.0
offset_right = 20.0
offset_bottom = 23.0
grow_horizontal = 2
text = "You WIN :3"
[node name="Label2" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -202.0
offset_top = 359.0
offset_right = 186.0
offset_bottom = 404.0
grow_horizontal = 2
text = "Your winrate is now: 80%"
[node name="Label3" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -897.0
offset_top = 120.0
offset_right = -509.0
offset_bottom = 165.0
grow_horizontal = 2
text = "Total games played: 315"
[node name="Label4" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -901.0
offset_top = 178.0
offset_right = -513.0
offset_bottom = 223.0
grow_horizontal = 2
text = "Total wins"
[node name="Label5" type="Label" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -874.0
offset_top = 239.0
offset_right = -486.0
offset_bottom = 284.0
grow_horizontal = 2
text = "Total losses"
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -298.0
offset_top = -20.0
offset_right = 298.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
[node name="PlayButton" type="Button" parent="HBoxContainer"]
layout_mode = 2
text = "play again :3"
[node name="QuitButton" type="Button" parent="HBoxContainer"]
layout_mode = 2
text = "quit to main menu :<"
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = SubResource("AudioStreamRandomizer_dram5")
bus = &"SFX"
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -20.0
offset_top = -40.0
offset_right = 20.0
grow_horizontal = 2
grow_vertical = 0
[connection signal="mouse_entered" from="HBoxContainer/PlayButton" to="." method="_on_button_mouse_entered"]
[connection signal="pressed" from="HBoxContainer/PlayButton" to="." method="_on_play_button_pressed"]
[connection signal="mouse_entered" from="HBoxContainer/QuitButton" to="." method="_on_button_mouse_entered"]
[connection signal="pressed" from="HBoxContainer/QuitButton" to="." method="_on_quit_button_pressed"]