feature updates

This commit is contained in:
2026-02-02 16:28:53 -05:00
parent bf9aa3fa23
commit 44c06530ac
83 changed files with 282641 additions and 11251 deletions

View File

@@ -5,7 +5,7 @@ extends CanvasLayer
## Allows selection of game type and decks for each player
signal back_pressed
signal start_game_requested(p1_deck: Array, p2_deck: Array)
signal start_game_requested(p1_deck: Array, p2_deck: Array, is_vs_ai: bool, ai_difficulty: int)
const WINDOW_SIZE := Vector2(800, 600)
@@ -15,6 +15,8 @@ var main_vbox: VBoxContainer
var title_label: Label
var game_type_container: HBoxContainer
var game_type_dropdown: OptionButton
var ai_difficulty_container: HBoxContainer
var ai_difficulty_dropdown: OptionButton
var players_container: HBoxContainer
var player1_panel: Control
var player2_panel: Control
@@ -25,6 +27,7 @@ var p2_preview: Control
var buttons_container: HBoxContainer
var start_button: Button
var back_button: Button
var p2_title_label: Label # Reference to update "PLAYER 2" / "AI OPPONENT"
# Deck data
var saved_decks: Array[String] = []
@@ -32,6 +35,10 @@ var starter_decks: Array = [] # Array of StarterDeckData
var p1_selected_deck: Array = [] # Card IDs
var p2_selected_deck: Array = [] # Card IDs
# AI settings
var is_vs_ai: bool = false
var ai_difficulty: int = AIStrategy.Difficulty.NORMAL # Default to Normal
func _ready() -> void:
# Set high layer to be on top of everything
@@ -114,14 +121,37 @@ func _create_game_type_selector() -> void:
game_type_container.add_child(label)
game_type_dropdown = OptionButton.new()
game_type_dropdown.custom_minimum_size = Vector2(250, 36)
game_type_dropdown.add_item("2-Player Local (Share Screen)")
game_type_dropdown.add_item("vs AI (Coming Soon)")
game_type_dropdown.set_item_disabled(1, true)
game_type_dropdown.custom_minimum_size = Vector2(200, 36)
game_type_dropdown.add_item("2-Player Local")
game_type_dropdown.add_item("vs AI")
game_type_dropdown.add_theme_font_size_override("font_size", 14)
game_type_dropdown.item_selected.connect(_on_game_type_changed)
_style_dropdown(game_type_dropdown)
game_type_container.add_child(game_type_dropdown)
# AI Difficulty dropdown (initially hidden)
ai_difficulty_container = HBoxContainer.new()
ai_difficulty_container.add_theme_constant_override("separation", 10)
ai_difficulty_container.visible = false
game_type_container.add_child(ai_difficulty_container)
var diff_label = Label.new()
diff_label.text = "Difficulty:"
diff_label.add_theme_font_size_override("font_size", 18)
diff_label.add_theme_color_override("font_color", Color(0.9, 0.85, 0.7))
ai_difficulty_container.add_child(diff_label)
ai_difficulty_dropdown = OptionButton.new()
ai_difficulty_dropdown.custom_minimum_size = Vector2(120, 36)
ai_difficulty_dropdown.add_item("Easy")
ai_difficulty_dropdown.add_item("Normal")
ai_difficulty_dropdown.add_item("Hard")
ai_difficulty_dropdown.select(1) # Default to Normal
ai_difficulty_dropdown.add_theme_font_size_override("font_size", 14)
ai_difficulty_dropdown.item_selected.connect(_on_ai_difficulty_changed)
_style_dropdown(ai_difficulty_dropdown)
ai_difficulty_container.add_child(ai_difficulty_dropdown)
func _create_player_panels() -> void:
players_container = HBoxContainer.new()
@@ -157,12 +187,17 @@ func _create_player_panel(title: String, player_num: int) -> Control:
margin.add_child(inner_vbox)
# Player title
var title_label = Label.new()
title_label.text = title
title_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
title_label.add_theme_font_size_override("font_size", 18)
title_label.add_theme_color_override("font_color", Color(1.0, 0.95, 0.8))
inner_vbox.add_child(title_label)
var player_title = Label.new()
player_title.name = "TitleLabel"
player_title.text = title
player_title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
player_title.add_theme_font_size_override("font_size", 18)
player_title.add_theme_color_override("font_color", Color(1.0, 0.95, 0.8))
inner_vbox.add_child(player_title)
# Store reference for Player 2 to update when AI mode changes
if player_num == 2:
p2_title_label = player_title
# Deck dropdown
var dropdown = OptionButton.new()
@@ -579,10 +614,26 @@ func _create_separator_style() -> StyleBoxFlat:
return style
func _on_game_type_changed(index: int) -> void:
is_vs_ai = (index == 1)
ai_difficulty_container.visible = is_vs_ai
# Update Player 2 panel title
if p2_title_label:
if is_vs_ai:
p2_title_label.text = "AI OPPONENT"
else:
p2_title_label.text = "PLAYER 2"
func _on_ai_difficulty_changed(index: int) -> void:
ai_difficulty = index # 0=Easy, 1=Normal, 2=Hard
func _on_back_pressed() -> void:
back_pressed.emit()
func _on_start_pressed() -> void:
if p1_selected_deck.size() >= 1 and p2_selected_deck.size() >= 1:
start_game_requested.emit(p1_selected_deck, p2_selected_deck)
start_game_requested.emit(p1_selected_deck, p2_selected_deck, is_vs_ai, ai_difficulty)