From a950e95b9795642f2814d756b5cbb4bb29c1add7 Mon Sep 17 00:00:00 2001 From: Adrien Ufferte Date: Tue, 20 Jan 2026 09:42:56 +0100 Subject: [PATCH] Penguin new label graphisms --- .../minigames_label_settings_penguins.tres | 11 ++++ sources/minigames/base/base_minigame.gd | 4 +- sources/minigames/penguin/penguin_label.gd | 6 +- sources/minigames/penguin/penguin_label.tscn | 25 ++++++--- sources/minigames/penguin/penguin_minigame.gd | 33 +++++++++-- .../minigames/penguin/penguin_minigame.tscn | 56 +++++++++++++------ 6 files changed, 102 insertions(+), 33 deletions(-) create mode 100644 resources/themes/minigames_label_settings_penguins.tres diff --git a/resources/themes/minigames_label_settings_penguins.tres b/resources/themes/minigames_label_settings_penguins.tres new file mode 100644 index 00000000..3458041a --- /dev/null +++ b/resources/themes/minigames_label_settings_penguins.tres @@ -0,0 +1,11 @@ +[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://jpm7cxm0xaeq"] + +[ext_resource type="FontFile" uid="uid://bj2rpti6g24kk" path="res://assets/fonts/kalulu_mulish_bold.otf" id="1_k63mv"] + +[resource] +font = ExtResource("1_k63mv") +font_size = 120 +font_color = Color(0, 0, 0, 1) +outline_color = Color(0, 0, 0, 1) +shadow_size = 0 +shadow_color = Color(0, 0, 0, 0.639216) diff --git a/sources/minigames/base/base_minigame.gd b/sources/minigames/base/base_minigame.gd index 5cb806ca..4df5a2c6 100644 --- a/sources/minigames/base/base_minigame.gd +++ b/sources/minigames/base/base_minigame.gd @@ -62,7 +62,7 @@ var current_lives: int = 0: var previous_lives: int = current_lives current_lives = value if current_lives != previous_lives: - Log.debug("BaseMinigame: Lives changed from %d to %d (max %d) for %s" % [previous_lives, current_lives, max_number_of_lives, Type.keys()[minigame_name]]) + Log.trace("BaseMinigame: Lives changed from %d to %d (max %d) for %s" % [previous_lives, current_lives, max_number_of_lives, Type.keys()[minigame_name]]) if current_lives < previous_lives: consecutive_errors += previous_lives - current_lives if current_lives <= max_number_of_lives - errors_before_help_speech: @@ -441,7 +441,7 @@ func _play_kalulu_help_speech() -> void: func set_current_progression(p_current_progression: int) -> void: var previous_progression: int = current_progression current_progression = p_current_progression - Log.debug("BaseMinigame: Progression changed from %d to %d/%d for %s" % [previous_progression, current_progression, max_progression, Type.keys()[minigame_name]]) + Log.trace("BaseMinigame: Progression changed from %d to %d/%d for %s" % [previous_progression, current_progression, max_progression, Type.keys()[minigame_name]]) consecutive_errors = 0 is_highlighting = false diff --git a/sources/minigames/penguin/penguin_label.gd b/sources/minigames/penguin/penguin_label.gd index 9cd2e139..95e9e1bc 100644 --- a/sources/minigames/penguin/penguin_label.gd +++ b/sources/minigames/penguin/penguin_label.gd @@ -28,13 +28,15 @@ func set_button_enabled(is_enabled: bool) -> void: func right() -> void: right_fx.play() - set("theme_override_colors/font_color", Minigame.LABEL_COLOR_WIN) + label_settings = label_settings.duplicate() + label_settings.font_color = Minigame.LABEL_COLOR_WIN await right_fx.finished func wrong() -> void: wrong_fx.play() - set("theme_override_colors/font_color", Minigame.LABEL_COLOR_LOSE) + label_settings = label_settings.duplicate() + label_settings.font_color = Minigame.LABEL_COLOR_LOSE await wrong_fx.finished diff --git a/sources/minigames/penguin/penguin_label.tscn b/sources/minigames/penguin/penguin_label.tscn index ce584d90..7cd15670 100644 --- a/sources/minigames/penguin/penguin_label.tscn +++ b/sources/minigames/penguin/penguin_label.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=5 format=3 uid="uid://hnhiv6odqvnk"] +[gd_scene load_steps=6 format=3 uid="uid://hnhiv6odqvnk"] +[ext_resource type="LabelSettings" uid="uid://jpm7cxm0xaeq" path="res://resources/themes/minigames_label_settings_penguins.tres" id="1_a244b"] [ext_resource type="Script" uid="uid://dgd47ntlm731" path="res://sources/minigames/penguin/penguin_label.gd" id="2_eu3c0"] [ext_resource type="PackedScene" uid="uid://cge0uyn30tcpv" path="res://sources/utils/fx/highlight.tscn" id="2_vlrm2"] [ext_resource type="PackedScene" uid="uid://cn2rw06pltyiu" path="res://sources/utils/fx/right.tscn" id="4_elaak"] @@ -7,14 +8,8 @@ [node name="PenguinLabel" type="Label"] mouse_filter = 0 -theme_override_colors/font_color = Color(0.635294, 0.639216, 0.643137, 0) -theme_override_colors/font_shadow_color = Color(0.780392, 0.913725, 0.984314, 1) -theme_override_colors/font_outline_color = Color(0.555189, 0.846948, 0.96363, 1) -theme_override_constants/shadow_offset_x = 10 -theme_override_constants/shadow_offset_y = -10 -theme_override_constants/outline_size = 15 -theme_override_font_sizes/font_size = 250 text = "test" +label_settings = ExtResource("1_a244b") script = ExtResource("2_eu3c0") [node name="BackFX" type="Control" parent="."] @@ -37,6 +32,10 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 +offset_left = 0.5 +offset_top = 67.5 +offset_right = 0.5 +offset_bottom = 67.5 grow_horizontal = 2 grow_vertical = 2 scale = Vector2(0.5, 0.5) @@ -44,12 +43,17 @@ scale = Vector2(0.5, 0.5) [node name="RightFX" parent="BackFX" instance=ExtResource("4_elaak")] unique_name_in_owner = true show_behind_parent = true +z_index = -1 layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 +offset_left = 0.5 +offset_top = 67.5 +offset_right = 0.5 +offset_bottom = 67.5 grow_horizontal = 2 grow_vertical = 2 scale = Vector2(0.5, 0.5) @@ -66,12 +70,17 @@ grow_vertical = 0 [node name="WrongFX" parent="FrontFX" instance=ExtResource("5_opr0c")] unique_name_in_owner = true +z_index = -1 layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 +offset_left = 0.5 +offset_top = 67.5 +offset_right = 0.5 +offset_bottom = 67.5 grow_horizontal = 2 grow_vertical = 2 scale = Vector2(0.5, 0.5) diff --git a/sources/minigames/penguin/penguin_minigame.gd b/sources/minigames/penguin/penguin_minigame.gd index e3eb63b7..5d554cb4 100644 --- a/sources/minigames/penguin/penguin_minigame.gd +++ b/sources/minigames/penguin/penguin_minigame.gd @@ -7,7 +7,8 @@ var max_word_progression: int = 0 var labels: Array[PenguinLabel] = [] @onready var penguin: Penguin = $GameRoot/Penguin -@onready var labels_container: HFlowContainer = $GameRoot/Control/LabelsContainer +@onready var sentence_background: HFlowContainer = %SentenceBackground +@onready var sentence_container: HFlowContainer = %Sentence # Find words with silent GPs @@ -79,13 +80,14 @@ func _start() -> void: _win() return _setup_word_progression() + sentence_background.show() # Setups the word progression for current progression func _setup_word_progression() -> void: max_word_progression = 0 - for node: Node in labels_container.get_children(): + for node: Node in sentence_container.get_children(): node.queue_free() labels.clear() @@ -99,7 +101,7 @@ func _setup_word_progression() -> void: if gp.WordID != last_word_id: last_word_id = gp.WordID word_container = HBoxContainer.new() - labels_container.add_child(word_container) + sentence_container.add_child(word_container) var label: PenguinLabel = LABEL_SCENE.instantiate() if first_gp: @@ -107,17 +109,38 @@ func _setup_word_progression() -> void: first_gp = false label.gp = gp word_container.add_child(label) - label.pressed.connect(_on_snowball_thrown.bind(label)) - labels.append(label) if gp.Type == 0: max_word_progression += 1 + setup_sentence_background() current_word_progression = 0 +func setup_sentence_background() -> void: + await get_tree().process_frame + var number_of_lines: int = sentence_container.get_line_count() + var children: Array[Node] = sentence_background.get_children() + if children.is_empty(): + Log.error("Ants Minigame: sentence_background has no child, but it should always at least keep 1") + return + if number_of_lines == children.size(): + return + while number_of_lines < sentence_background.get_children().size(): + var child: Node = sentence_background.get_child(-1) # Get last child + child.queue_free() + await get_tree().process_frame + if number_of_lines == children.size(): + return + var template: Node = children[0] + while number_of_lines > sentence_background.get_children().size(): + var new_child: Node = template.duplicate() + sentence_background.add_child(new_child) + await get_tree().process_frame + + func _highlight() -> void: for label: PenguinLabel in labels: if self._is_silent(label.gp) and not label.is_pressed: diff --git a/sources/minigames/penguin/penguin_minigame.tscn b/sources/minigames/penguin/penguin_minigame.tscn index 8d48ed62..4f7ecc45 100644 --- a/sources/minigames/penguin/penguin_minigame.tscn +++ b/sources/minigames/penguin/penguin_minigame.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=3 uid="uid://dpp3bpy1v80jk"] +[gd_scene load_steps=8 format=3 uid="uid://dpp3bpy1v80jk"] [ext_resource type="PackedScene" uid="uid://8awe4usnucyv" path="res://sources/minigames/base/base_minigame.tscn" id="1_s6yuv"] [ext_resource type="Script" uid="uid://250f3suy83hr" path="res://sources/minigames/penguin/penguin_minigame.gd" id="2_ncha4"] @@ -6,11 +6,12 @@ [ext_resource type="Texture2D" uid="uid://kwcp3ondyggo" path="res://assets/minigames/penguin/graphic/gauge_icon_penguin_empty.png" id="3_gdpi3"] [ext_resource type="PackedScene" uid="uid://b78362g1yif2n" path="res://sources/minigames/penguin/penguin.tscn" id="4_txvyj"] [ext_resource type="Texture2D" uid="uid://dq23np4euf6da" path="res://assets/minigames/penguin/graphic/gauge_icon_penguin_full.png" id="4_yua7j"] +[ext_resource type="Texture2D" uid="uid://b2bcmo1keh217" path="res://assets/minigames/ants/graphics/sentence_text_box.png" id="7_8iqp0"] [node name="PenguinMinigame" instance=ExtResource("1_s6yuv")] script = ExtResource("2_ncha4") minigame_name = 8 -lesson_nb = 14 +lesson_nb = 60 max_number_of_lives = 5 max_progression = 5 @@ -20,6 +21,7 @@ full_progression_icon = ExtResource("4_yua7j") stimulus_button_visible = false [node name="Background" type="TextureRect" parent="GameRoot" index="0"] +z_index = -99 layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -31,25 +33,47 @@ texture = ExtResource("3_8crb3") [node name="Penguin" parent="GameRoot" index="1" instance=ExtResource("4_txvyj")] position = Vector2(637, 1314) -[node name="Control" type="Control" parent="GameRoot" index="2"] +[node name="SentenceBackground" type="HFlowContainer" parent="GameRoot" index="2"] +unique_name_in_owner = true +visible = false +custom_minimum_size = Vector2(0, 159) layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = 325.0 -offset_right = -264.0 -offset_bottom = -680.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="LabelsContainer" type="HFlowContainer" parent="GameRoot/Control" index="0"] -layout_mode = 1 -anchors_preset = 14 +anchors_preset = 8 +anchor_left = 0.5 anchor_top = 0.5 -anchor_right = 1.0 +anchor_right = 0.5 anchor_bottom = 0.5 +offset_left = -800.0 +offset_top = -780.0 +offset_right = 1008.0 +offset_bottom = -180.0 grow_horizontal = 2 grow_vertical = 2 +mouse_filter = 2 +theme_override_constants/v_separation = 20 +alignment = 1 + +[node name="TextureRect" type="TextureRect" parent="GameRoot/SentenceBackground" index="0"] +z_index = -2 +layout_mode = 2 +texture = ExtResource("7_8iqp0") +stretch_mode = 2 + +[node name="Sentence" type="HFlowContainer" parent="GameRoot" index="3"] +unique_name_in_owner = true +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -800.0 +offset_top = -780.0 +offset_right = 1008.0 +offset_bottom = -180.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 theme_override_constants/h_separation = 48 theme_override_constants/v_separation = 20 alignment = 1