added selling cards and made shop items cheaper
This commit is contained in:
parent
e84496dcf8
commit
05914a3c64
@ -145,10 +145,10 @@ func focus_target() -> Vector3:
|
||||
func get_strafe_tilt(player_velocity: Vector3) -> Vector3:
|
||||
var side_dot: float = player_velocity.normalized().dot(-global_transform.basis.z)
|
||||
var front_dot: float = player_velocity.normalized().dot(-global_transform.basis.x)
|
||||
var speed_factor: float = player_velocity.length() / tilt_max_effect_speed
|
||||
var tilt_speed_factor: float = player_velocity.length() / tilt_max_effect_speed
|
||||
var tilt_vector: Vector3 = Vector3.ZERO
|
||||
tilt_vector.z = deg_to_rad(tilt_amount_x * front_dot * speed_factor)
|
||||
tilt_vector.x = deg_to_rad(tilt_amount_y * -side_dot * speed_factor)
|
||||
tilt_vector.z = deg_to_rad(tilt_amount_x * front_dot * tilt_speed_factor)
|
||||
tilt_vector.x = deg_to_rad(tilt_amount_y * -side_dot * tilt_speed_factor)
|
||||
return tilt_vector
|
||||
|
||||
|
||||
|
@ -6,16 +6,18 @@ class_name CardPrinter extends StaticBody3D
|
||||
@export var button_box: Node3D
|
||||
@export var choice_colliders: Array[CollisionShape3D]
|
||||
|
||||
var cards_generated: int = 0
|
||||
var card_available: bool = false
|
||||
var reply_player: Hero
|
||||
|
||||
|
||||
func randomize_cards() -> void:
|
||||
func generate_rarity() -> int:
|
||||
var weight_total: int = 0
|
||||
for rarity: String in Data.Rarity:
|
||||
weight_total += Data.rarity_weights[rarity]
|
||||
|
||||
var generated_rarity: int = randi_range(0, weight_total)
|
||||
var generated_rarity: int = Game.randi_in_range(4 * cards_generated, 0, weight_total)
|
||||
cards_generated += 1
|
||||
var decided_rarity: int = 0
|
||||
|
||||
for rarity: String in Data.Rarity:
|
||||
@ -23,7 +25,11 @@ func randomize_cards() -> void:
|
||||
if generated_rarity >= weight_total:
|
||||
decided_rarity = Data.Rarity[rarity]
|
||||
break
|
||||
return decided_rarity
|
||||
|
||||
|
||||
func randomize_cards() -> void:
|
||||
var decided_rarity: int = generate_rarity()
|
||||
var card_array: Array = []
|
||||
for x: Card in Data.cards:
|
||||
if x.rarity == decided_rarity:
|
||||
@ -31,7 +37,8 @@ func randomize_cards() -> void:
|
||||
var card: Card
|
||||
for x: CardInHand in cards:
|
||||
if card_array.size() > 0:
|
||||
card = card_array.pick_random()
|
||||
card = card_array[Game.randi_in_range(132 * cards_generated, 0, card_array.size() - 1)]
|
||||
cards_generated += 1
|
||||
card_array.erase(card)
|
||||
x.set_card(card)
|
||||
#TODO: in reality this should just show the icon and then hovering over it lets you see either side at the players own discretion
|
||||
@ -42,7 +49,7 @@ func randomize_cards() -> void:
|
||||
card_available = true
|
||||
|
||||
|
||||
func retrieve_card(i: int, reply: Hero) -> void:
|
||||
func retrieve_card(i: int, _reply: Hero) -> void:
|
||||
$Node3D.set_visible(false)
|
||||
for x: CollisionShape3D in choice_colliders:
|
||||
x.disabled = true
|
||||
|
@ -1,31 +1,43 @@
|
||||
class_name WonGameScreen extends Control
|
||||
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)
|
||||
$Label2.text = "Your 20-game winrate is now: " + str(winrate) + "%!"
|
||||
$Label3.text = "Total games: " + str(Data.save_stats.wins + Data.save_stats.losses)
|
||||
$Label4.text = "Total wins: " + str(Data.save_stats.wins)
|
||||
$Label5.text = "Total losses: " + str(Data.save_stats.losses)
|
||||
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
|
||||
$VBoxContainer.add_child(spawned_box)
|
||||
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.restart_game()
|
||||
Game.setup()
|
||||
Game.start()
|
||||
queue_free()
|
||||
|
||||
|
93
Scenes/Menus/GameEndScreen/game_end_screen.tscn
Normal file
93
Scenes/Menus/GameEndScreen/game_end_screen.tscn
Normal 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"]
|
@ -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()
|
||||
|
||||
|
||||
|
@ -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"]
|
@ -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"]
|
||||
|
@ -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"]
|
@ -7,12 +7,14 @@ class_name ShopStand extends Node3D
|
||||
@export var item_card_scene: PackedScene
|
||||
|
||||
var price_dict: Dictionary = {
|
||||
Data.Rarity.UNCOMMON : 30,
|
||||
Data.Rarity.RARE : 50,
|
||||
Data.Rarity.EPIC : 75,
|
||||
Data.Rarity.LEGENDARY : 100,
|
||||
Data.Rarity.UNCOMMON : 25,
|
||||
Data.Rarity.RARE : 40,
|
||||
Data.Rarity.EPIC : 60,
|
||||
Data.Rarity.LEGENDARY : 85,
|
||||
}
|
||||
|
||||
var cards_generated: int = 0
|
||||
|
||||
|
||||
func close() -> void:
|
||||
for x: CollisionShape3D in choice_colliders:
|
||||
@ -34,19 +36,22 @@ func randomize_cards() -> void:
|
||||
pricey_cards.append(card)
|
||||
|
||||
for x: int in 3:
|
||||
var chosen_card: Card = cheap_cards.pick_random()
|
||||
var chosen_card: Card = cheap_cards[Game.randi_in_range(12 * cards_generated, 0, cheap_cards.size() - 1)]
|
||||
cards_generated += 1
|
||||
cards[x].set_card(chosen_card)
|
||||
cards[x].view_tower()
|
||||
choice_buttons[x].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x].hover_text = "Spend $" + str(choice_buttons[x].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
for x: int in 2:
|
||||
var chosen_card: Card = medium_cards.pick_random()
|
||||
var chosen_card: Card = medium_cards[Game.randi_in_range(9 * cards_generated, 0, medium_cards.size() - 1)]
|
||||
cards_generated += 1
|
||||
cards[x+3].set_card(chosen_card)
|
||||
cards[x+3].view_tower()
|
||||
choice_buttons[x+3].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x+3].hover_text = "Spend $" + str(choice_buttons[x+3].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
for x: int in 1:
|
||||
var chosen_card: Card = pricey_cards.pick_random()
|
||||
var chosen_card: Card = pricey_cards[Game.randi_in_range(50 * cards_generated, 0, pricey_cards.size() - 1)]
|
||||
cards_generated += 1
|
||||
cards[x+5].set_card(chosen_card)
|
||||
cards[x+5].view_tower()
|
||||
choice_buttons[x+5].press_cost = price_dict[chosen_card.rarity]
|
||||
|
6
Scenes/Shredder/shredder.gd
Normal file
6
Scenes/Shredder/shredder.gd
Normal file
@ -0,0 +1,6 @@
|
||||
class_name Shredder extends StaticBody3D
|
||||
|
||||
|
||||
func _on_interact_button_button_interacted(_value: int, callback: Hero) -> void:
|
||||
var card: Card = callback.inventory.remove_at(callback.inventory_selected_index) as Card
|
||||
callback.currency += 5 * (card.rarity + 1)
|
45
Scenes/Shredder/shredder.tscn
Normal file
45
Scenes/Shredder/shredder.tscn
Normal file
@ -0,0 +1,45 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://c2avjln5vmr0y"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scenes/Shredder/shredder.gd" id="1_diuqd"]
|
||||
[ext_resource type="Script" path="res://Scripts/interact_button.gd" id="1_toyr6"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_waypt"]
|
||||
albedo_color = Color(0.909804, 0.113725, 0.113725, 1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o3ege"]
|
||||
albedo_color = Color(1, 0.498039, 0.0941176, 1)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_yxwll"]
|
||||
size = Vector3(1, 1.1, 0.7)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_5mxpr"]
|
||||
size = Vector3(0.925, 0.3, 0.4)
|
||||
|
||||
[node name="Shredder" type="StaticBody3D"]
|
||||
script = ExtResource("1_diuqd")
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0)
|
||||
size = Vector3(1, 1.1, 0.7)
|
||||
material = SubResource("StandardMaterial3D_waypt")
|
||||
|
||||
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGBox3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.58128, 0)
|
||||
operation = 2
|
||||
size = Vector3(0.8, 0.4, 0.2)
|
||||
material = SubResource("StandardMaterial3D_o3ege")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55, 0)
|
||||
shape = SubResource("BoxShape3D_yxwll")
|
||||
|
||||
[node name="InteractButton" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.08506, 0)
|
||||
collision_layer = 16
|
||||
script = ExtResource("1_toyr6")
|
||||
hover_text = "[center]#Interact# to shred card"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractButton"]
|
||||
shape = SubResource("BoxShape3D_5mxpr")
|
||||
|
||||
[connection signal="button_interacted" from="InteractButton" to="." method="_on_interact_button_button_interacted"]
|
140
Scripts/game.gd
140
Scripts/game.gd
@ -3,9 +3,9 @@ extends Node
|
||||
signal wave_started(wave_number: int)
|
||||
signal wave_finished(wave_number: int)
|
||||
signal base_took_damage(remaining_health: int)
|
||||
signal rng_seeded()
|
||||
signal rng_seeded
|
||||
signal game_setup
|
||||
signal game_started
|
||||
signal game_restarted
|
||||
signal lost_game
|
||||
signal won_game
|
||||
|
||||
@ -14,8 +14,7 @@ var player_scene: PackedScene = load("res://PCs/hero.tscn")
|
||||
var main_menu_scene_path: String = "res://Scenes/Menus/MainMenu/main_menu.tscn"
|
||||
var multiplayer_lobby_scene_path: String = "res://Scenes/Menus/multiplayer_lobby.tscn"
|
||||
var singleplayer_lobby_scene_path: String = "res://Scenes/Menus/singleplayer_lobby.tscn"
|
||||
var won_game_scene: PackedScene = load("res://Scenes/Menus/won_game_screen.tscn")
|
||||
var lose_game_scene: PackedScene = load("res://Scenes/Menus/lost_game_screen.tscn")
|
||||
var game_end_scene: PackedScene = load("res://Scenes/Menus/GameEndScreen/game_end_screen.tscn")
|
||||
var connected_players_nodes: Dictionary = {}
|
||||
var game_active: bool = false
|
||||
var level: Level
|
||||
@ -30,9 +29,12 @@ var chatbox: Chatbox
|
||||
var wave_limit: int = 20
|
||||
var starting_cash: int = 16
|
||||
var shop_chance: float = 0.0
|
||||
var stats: RoundStats = RoundStats.new()
|
||||
var stats: RoundStats
|
||||
var rng: FastNoiseLite
|
||||
|
||||
#TODO: Create a reference to some generic Lobby object that wraps the multiplayer players list stuff
|
||||
var connected_player_profiles: Dictionary = {}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
UILayer = CanvasLayer.new()
|
||||
@ -44,13 +46,19 @@ func _ready() -> void:
|
||||
func set_seed(value: int) -> void:
|
||||
rng = FastNoiseLite.new()
|
||||
rng.noise_type = FastNoiseLite.TYPE_VALUE
|
||||
rng.frequency = 1
|
||||
rng.frequency = 30
|
||||
rng.fractal_octaves = 2
|
||||
rng.fractal_gain = 0.1
|
||||
rng.seed = value
|
||||
rng_seeded.emit()
|
||||
|
||||
|
||||
func randi_in_range(sample: float, start: float, end: float) -> int:
|
||||
return floori(remap(rng.get_noise_1d(sample), -1.0, 1.0, start, end + 1))
|
||||
func randi_in_range(sample: float, output_start: int, output_end: int) -> int:
|
||||
return floori(remap(rng.get_noise_1d(sample), -1.0, 1.0, float(output_start), float(output_end + 1)))
|
||||
|
||||
|
||||
func randf_in_range(sample: float, output_start: float, output_end: float) -> float:
|
||||
return remap(rng.get_noise_1d(sample), -1.0, 1.0, output_start, output_end)
|
||||
|
||||
|
||||
func parse_command(text: String, peer_id: int) -> void:
|
||||
@ -118,20 +126,21 @@ func spawn_level() -> void:
|
||||
add_child(level)
|
||||
|
||||
|
||||
func spawn_players(player_array: Array, player_profiles: Dictionary, chatbox_open_signal: Signal, chatbox_closed_signal: Signal) -> void:
|
||||
func spawn_players() -> void:
|
||||
var p_i: int = 0
|
||||
var player_array: Array = connected_player_profiles.keys()
|
||||
player_array.sort()
|
||||
for peer_id: int in player_array:
|
||||
var player: Hero = player_scene.instantiate() as Hero
|
||||
player.name = str(peer_id)
|
||||
player.player_name_tag.text = player_profiles[peer_id].display_name
|
||||
player.player_name_tag.text = connected_player_profiles[peer_id].display_name
|
||||
player.position = level.player_spawns[p_i].global_position
|
||||
player.profile = player_profiles[peer_id]
|
||||
player.hero_class = Data.characters[player_profiles[peer_id].preferred_class]
|
||||
player.profile = connected_player_profiles[peer_id]
|
||||
player.hero_class = Data.characters[connected_player_profiles[peer_id].preferred_class]
|
||||
player.ready_state_changed.connect(ready_player)
|
||||
if peer_id == multiplayer.get_unique_id():
|
||||
chatbox_open_signal.connect(player.pause)
|
||||
chatbox_closed_signal.connect(player.unpause)
|
||||
chatbox.opened.connect(player.pause)
|
||||
chatbox.closed.connect(player.unpause)
|
||||
player.set_multiplayer_authority(peer_id)
|
||||
connected_players_nodes[peer_id] = player
|
||||
wave_started.connect(player.exit_editing_mode)
|
||||
@ -140,7 +149,6 @@ func spawn_players(player_array: Array, player_profiles: Dictionary, chatbox_ope
|
||||
add_child(player)
|
||||
p_i += 1
|
||||
level.cinematic_cam.does_its_thing = false
|
||||
start_game()
|
||||
|
||||
|
||||
func ready_player(player_ready_true: bool) -> void:
|
||||
@ -154,7 +162,7 @@ func ready_player(player_ready_true: bool) -> void:
|
||||
ready_players += 1
|
||||
if ready_players == connected_players_nodes.size():
|
||||
spawn_enemy_wave()
|
||||
chatbox.append_message("SERVER", Color.TOMATO, "Wave Started!")
|
||||
#chatbox.append_message("SERVER", Color.TOMATO, "Wave Started!")
|
||||
else:
|
||||
chatbox.append_message("SERVER", Color.TOMATO, str(ready_players) + "/" + str(connected_players_nodes.size()) + " Players ready")
|
||||
|
||||
@ -208,7 +216,7 @@ func enemy_died(enemy: Enemy) -> void:
|
||||
if enemies == 0:
|
||||
end_wave()
|
||||
if !endless_mode and wave >= wave_limit:
|
||||
win_game()
|
||||
end(true)
|
||||
|
||||
|
||||
func damage_goal(enemy: Enemy, penalty: int) -> void:
|
||||
@ -219,11 +227,11 @@ func damage_goal(enemy: Enemy, penalty: int) -> void:
|
||||
objective_health -= penalty
|
||||
base_took_damage.emit(objective_health)
|
||||
if objective_health <= 0:
|
||||
lose_game()
|
||||
end(false)
|
||||
elif enemies == 0:
|
||||
end_wave()
|
||||
if !endless_mode and wave >= wave_limit:
|
||||
win_game()
|
||||
end(true)
|
||||
|
||||
|
||||
func end_wave() -> void:
|
||||
@ -233,11 +241,11 @@ func end_wave() -> void:
|
||||
level.a_star_graph_3d.visualized_path.enable_visualization()
|
||||
level.a_star_graph_3d.enable_non_path_tower_frames()
|
||||
if is_multiplayer_authority():
|
||||
if randf() <= shop_chance:
|
||||
if randf_in_range(23 * wave, 0.0, 1.0) <= shop_chance:
|
||||
networked_spawn_shop.rpc()
|
||||
shop_chance = 0.0
|
||||
else:
|
||||
shop_chance += 0.05
|
||||
shop_chance += 0.07
|
||||
wave_finished.emit(wave)
|
||||
set_upcoming_wave()
|
||||
|
||||
@ -254,68 +262,68 @@ func remove_player(peer_id: int) -> void:
|
||||
connected_players_nodes.erase(peer_id)
|
||||
|
||||
|
||||
func start_game() -> void:
|
||||
if is_multiplayer_authority():
|
||||
set_seed.rpc(randi())
|
||||
else:
|
||||
await rng_seeded
|
||||
game_active = true
|
||||
func setup() -> void:
|
||||
#clean up old stuff
|
||||
if level:
|
||||
level.queue_free()
|
||||
for peer_id: int in connected_players_nodes:
|
||||
connected_players_nodes[peer_id].queue_free()
|
||||
connected_players_nodes.clear()
|
||||
|
||||
#Spawn new stuff
|
||||
spawn_level()
|
||||
|
||||
#Set starting parameters
|
||||
game_active = false
|
||||
enemies = 0
|
||||
objective_health = 120
|
||||
wave = 0
|
||||
stats = RoundStats.new()
|
||||
game_setup.emit()
|
||||
|
||||
|
||||
func start(rng_seed: int = randi()) -> void:
|
||||
if is_multiplayer_authority():
|
||||
set_seed.rpc(rng_seed)
|
||||
else:
|
||||
await rng_seeded
|
||||
|
||||
#Relies on player list having been decided
|
||||
spawn_players()
|
||||
for peer_id: int in connected_players_nodes:
|
||||
connected_players_nodes[peer_id].currency = ceili(float(starting_cash) / float(connected_players_nodes.size()))
|
||||
|
||||
#Relies on rng having been seeded
|
||||
set_upcoming_wave()
|
||||
level.a_star_graph_3d.make_grid()
|
||||
level.generate_obstacles()
|
||||
level.a_star_graph_3d.disable_all_tower_frames()
|
||||
level.a_star_graph_3d.enable_non_path_tower_frames()
|
||||
level.a_star_graph_3d.find_path()
|
||||
set_upcoming_wave()
|
||||
for peer_id: int in connected_players_nodes:
|
||||
connected_players_nodes[peer_id].currency = roundi(float(starting_cash) / float(connected_players_nodes.size()))
|
||||
|
||||
#Start game
|
||||
game_active = true
|
||||
chatbox.append_message("SERVER", Color.TOMATO, "Started with seed: " + str(rng.seed))
|
||||
game_started.emit()
|
||||
|
||||
|
||||
func restart_game() -> void:
|
||||
#implement game reloading system
|
||||
for peer_id: int in connected_players_nodes:
|
||||
connected_players_nodes[peer_id].queue_free()
|
||||
connected_players_nodes.clear()
|
||||
level.queue_free()
|
||||
enemies = 0
|
||||
objective_health = 120
|
||||
wave = 0
|
||||
stats = RoundStats.new()
|
||||
spawn_level()
|
||||
game_restarted.emit()
|
||||
pass
|
||||
|
||||
|
||||
func lose_game() -> void:
|
||||
func end(outcome: bool) -> void:
|
||||
if game_active == false:
|
||||
return
|
||||
game_active = false
|
||||
Data.save_stats.add_game_outcome(false)
|
||||
Data.save_stats.add_game_outcome(outcome)
|
||||
Data.save_stats.save_profile_to_disk()
|
||||
var menu: Control = lose_game_scene.instantiate()
|
||||
var menu: GameEndScreen = game_end_scene.instantiate() as GameEndScreen
|
||||
match outcome:
|
||||
false:
|
||||
menu.set_outcome_message("You lost...")
|
||||
lost_game.emit()
|
||||
true:
|
||||
menu.set_outcome_message("You win!")
|
||||
won_game.emit()
|
||||
UILayer.add_child(menu)
|
||||
lost_game.emit()
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
for peer_id: int in connected_players_nodes:
|
||||
connected_players_nodes[peer_id].pause()
|
||||
|
||||
|
||||
func win_game() -> void:
|
||||
if game_active == false:
|
||||
return
|
||||
game_active = false
|
||||
Data.save_stats.add_game_outcome(true)
|
||||
Data.save_stats.save_profile_to_disk()
|
||||
var menu: Control = won_game_scene.instantiate()
|
||||
UILayer.add_child(menu)
|
||||
won_game.emit()
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
for peer_id: int in connected_players_nodes:
|
||||
connected_players_nodes[peer_id].pause()
|
||||
connected_players_nodes[multiplayer.get_unique_id()].pause()
|
||||
|
||||
|
||||
func quit_to_desktop() -> void:
|
||||
@ -327,6 +335,8 @@ func quit_to_desktop() -> void:
|
||||
func scene_switch_main_menu() -> void:
|
||||
for node: Node in get_children():
|
||||
node.queue_free()
|
||||
level = null
|
||||
connected_players_nodes.clear()
|
||||
multiplayer.multiplayer_peer.close()
|
||||
multiplayer.multiplayer_peer = null
|
||||
get_tree().change_scene_to_file(main_menu_scene_path)
|
||||
|
@ -4,7 +4,7 @@ signal button_interacted(value: int, callback: Hero)
|
||||
|
||||
@export var button_press_value: int = 0
|
||||
@export var press_cost: int = 0
|
||||
@export var hover_text: String = "Press [Interact]"
|
||||
@export var hover_text: String = "#Interact# to [do thing]"
|
||||
|
||||
|
||||
func press(callback_player: Hero) -> void:
|
||||
|
@ -33,7 +33,7 @@ func generate_obstacles() -> void:
|
||||
|
||||
func cell_coord_to_astar_point(x: int, y: int) -> int:
|
||||
var center_point_x: int = floori(a_star_graph_3d.grid_size.x / 2.0) * a_star_graph_3d.grid_size.y
|
||||
var center_point_y: int = a_star_graph_3d.grid_size.y / 2.0
|
||||
var center_point_y: int = floori(a_star_graph_3d.grid_size.y / 2.0)
|
||||
return (center_point_x + ((x / 2.0) * a_star_graph_3d.grid_size.y)) + (center_point_y + (y / 2.0))
|
||||
|
||||
|
||||
|
@ -1,33 +0,0 @@
|
||||
class_name LostGameScreen extends Control
|
||||
|
||||
@export var box: PackedScene
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var wins: float = float(Data.save_stats.twenty_game_history.count(true))
|
||||
var games: float = float(Data.save_stats.twenty_game_history.size())
|
||||
var winrate: int = int((wins / games) * 100.0)
|
||||
$Label2.text = "Your 20-game winrate is now: " + str(winrate) + "%!"
|
||||
$Label3.text = "Total games: " + str(Data.save_stats.wins + Data.save_stats.losses)
|
||||
$Label4.text = "Total wins: " + str(Data.save_stats.wins)
|
||||
$Label5.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
|
||||
$VBoxContainer.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 _on_quit_button_pressed() -> void:
|
||||
Game.scene_switch_main_menu()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_restart_button_pressed() -> void:
|
||||
Game.restart_game()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_button_mouse_entered() -> void:
|
||||
$AudioStreamPlayer.play()
|
@ -60,17 +60,16 @@ func create_server() -> void:
|
||||
|
||||
func setup_game(peer_id: int) -> void:
|
||||
player_disconnected.connect(Game.remove_player)
|
||||
Game.spawn_level()
|
||||
scoreboard.all_players_ready.connect(start_game)
|
||||
Game.game_restarted.connect(setup_the_ui)
|
||||
Game.game_setup.connect(setup_the_ui)
|
||||
Game.chatbox = chatbox
|
||||
setup_the_ui()
|
||||
chatbox.username = Data.player_profile.display_name
|
||||
Data.player_profile.display_name_changed.connect(chatbox.change_username)
|
||||
loadout_editor.hero_selected.connect(Data.player_profile.set_preferred_class)
|
||||
loadout_editor.hero_selected.connect(edit_player_profile)
|
||||
connected_players_profiles[peer_id] = Data.player_profile
|
||||
player_connected.emit(peer_id, Data.player_profile)
|
||||
Game.setup()
|
||||
|
||||
|
||||
func setup_the_ui() -> void:
|
||||
@ -95,9 +94,10 @@ func ready_player() -> void:
|
||||
|
||||
func start_game() -> void:
|
||||
enet_peer.refuse_new_connections = true
|
||||
Game.spawn_players(connected_players_profiles.keys(), connected_players_profiles, chatbox.opened, chatbox.closed)
|
||||
scoreboard.set_visible(false)
|
||||
loadout_editor.set_visible(false)
|
||||
Game.connected_player_profiles = connected_players_profiles
|
||||
Game.start()
|
||||
|
||||
|
||||
#TODO: what the fuck is this doing lol
|
||||
|
@ -3,6 +3,9 @@ class_name SinglePlayerLobby extends Control
|
||||
@export var scoreboard: Scoreboard
|
||||
@export var loadout_editor: HeroSelector
|
||||
@export var chatbox: Chatbox
|
||||
@export var seed_entry: LineEdit
|
||||
@export var ready_button: Button
|
||||
@export var daily_button: Button
|
||||
|
||||
var connected_players_profiles: Dictionary = {}
|
||||
var enet_peer: ENetMultiplayerPeer = ENetMultiplayerPeer.new()
|
||||
@ -16,22 +19,33 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func setup_game() -> void:
|
||||
Game.spawn_level()
|
||||
scoreboard.add_player(1, Data.player_profile)
|
||||
scoreboard.all_players_ready.connect(start_game)
|
||||
Game.game_restarted.connect(setup_the_ui)
|
||||
Game.game_setup.connect(setup_the_ui)
|
||||
Game.chatbox = chatbox
|
||||
setup_the_ui()
|
||||
chatbox.username = Data.player_profile.display_name
|
||||
Data.player_profile.display_name_changed.connect(chatbox.change_username)
|
||||
loadout_editor.hero_selected.connect(Data.player_profile.set_preferred_class)
|
||||
connected_players_profiles[1] = Data.player_profile
|
||||
Game.setup()
|
||||
|
||||
|
||||
func start_game() -> void:
|
||||
Game.spawn_players(connected_players_profiles.keys(), connected_players_profiles, chatbox.opened, chatbox.closed)
|
||||
scoreboard.set_visible(false)
|
||||
loadout_editor.set_visible(false)
|
||||
seed_entry.set_visible(false)
|
||||
daily_button.set_visible(false)
|
||||
ready_button.set_visible(false)
|
||||
Game.connected_player_profiles = connected_players_profiles
|
||||
var chosen_seed: int
|
||||
if seed_entry.text != "":
|
||||
if seed_entry.text.is_valid_int():
|
||||
chosen_seed = int(seed_entry.text)
|
||||
else:
|
||||
chosen_seed = hash(seed_entry.text)
|
||||
Game.start(chosen_seed)
|
||||
else:
|
||||
Game.start()
|
||||
|
||||
|
||||
func setup_the_ui() -> void:
|
||||
@ -40,7 +54,20 @@ func setup_the_ui() -> void:
|
||||
loadout_editor.set_visible(true)
|
||||
$ReadyButton.set_visible(true)
|
||||
chatbox.set_visible(true)
|
||||
seed_entry.set_visible(true)
|
||||
daily_button.set_visible(true)
|
||||
ready_button.set_visible(true)
|
||||
|
||||
|
||||
func _on_button_mouse_entered() -> void:
|
||||
$AudioStreamPlayer.play()
|
||||
|
||||
|
||||
func _on_daily_button_pressed() -> void:
|
||||
scoreboard.set_visible(false)
|
||||
loadout_editor.set_visible(false)
|
||||
seed_entry.set_visible(false)
|
||||
daily_button.set_visible(false)
|
||||
ready_button.set_visible(false)
|
||||
Game.connected_player_profiles = connected_players_profiles
|
||||
Game.start(hash(Time.get_date_string_from_system(true)))
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=48 format=3 uid="uid://y1qa1g3ic8sp"]
|
||||
[gd_scene load_steps=49 format=3 uid="uid://y1qa1g3ic8sp"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/level.gd" id="1_ws6nn"]
|
||||
[ext_resource type="PackedScene" uid="uid://d2yv447trxkwt" path="res://Scenes/enemy_spawner.tscn" id="3_5imwp"]
|
||||
@ -26,6 +26,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://7g3jev3v6d3l" path="res://Scenes/ShopStand/shop_stand.tscn" id="19_h6brl"]
|
||||
[ext_resource type="Texture2D" uid="uid://r202vo47jw1q" path="res://Assets/Textures/enemyhealth.png" id="21_flsqn"]
|
||||
[ext_resource type="Script" path="res://Scripts/killbox.gd" id="26_tuncf"]
|
||||
[ext_resource type="PackedScene" uid="uid://c2avjln5vmr0y" path="res://Scenes/Shredder/shredder.tscn" id="27_gppb4"]
|
||||
|
||||
[sub_resource type="Curve3D" id="Curve3D_3rdl2"]
|
||||
_data = {
|
||||
@ -1134,5 +1135,8 @@ level = NodePath("..")
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -6.8471, 0)
|
||||
shape = SubResource("BoxShape3D_134um")
|
||||
|
||||
[node name="Shredder" parent="." instance=ExtResource("27_gppb4")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.365, 0.5, 4.44575)
|
||||
|
||||
[connection signal="body_entered" from="EnemyGoal/Area3D" to="EnemyGoal" method="_on_area_3d_body_entered"]
|
||||
[connection signal="body_entered" from="Area3D" to="Area3D" method="_on_body_entered"]
|
||||
|
File diff suppressed because one or more lines are too long
17
enemybox.gd
17
enemybox.gd
@ -6,9 +6,14 @@ func set_wave(wave: int) -> void:
|
||||
|
||||
|
||||
func add_enemy_tag(enemy: Enemy, num: int) -> void:
|
||||
var name_label: Label = Label.new()
|
||||
name_label.text = enemy.title
|
||||
var num_label: Label = Label.new()
|
||||
num_label.text = str(num)
|
||||
add_child(name_label)
|
||||
add_child(num_label)
|
||||
for x: int in num:
|
||||
var enemy_tex: TextureRect = TextureRect.new()
|
||||
enemy_tex.texture = enemy.sprite
|
||||
enemy_tex.custom_minimum_size = Vector2(80, 80)
|
||||
add_child(enemy_tex)
|
||||
#var name_label: Label = Label.new()
|
||||
#name_label.text = enemy.title
|
||||
#var num_label: Label = Label.new()
|
||||
#num_label.text = str(num)
|
||||
#add_child(name_label)
|
||||
#add_child(num_label)
|
||||
|
@ -35,6 +35,7 @@ window/size/viewport_height=1080
|
||||
|
||||
folder_colors={
|
||||
"res://Assets/": "purple",
|
||||
"res://Audio/": "red",
|
||||
"res://PCs/": "blue",
|
||||
"res://Resources/": "green",
|
||||
"res://Scenes/": "yellow",
|
||||
|
Loading…
x
Reference in New Issue
Block a user