Merge pull request #197 from Excello-Recherche-Education/penguin-labels

Penguin new label graphisms
This commit is contained in:
Adrien Ufferte
2026-01-20 15:21:02 +01:00
committed by GitHub
6 changed files with 102 additions and 33 deletions
+2 -2
View File
@@ -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
+4 -2
View File
@@ -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
+17 -8
View File
@@ -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)
+28 -5
View File
@@ -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
@@ -80,13 +81,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()
@@ -100,7 +102,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:
@@ -108,17 +110,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:
+40 -16
View File
@@ -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