From 77affb11bf711558c551bccdf48d1c9d02d1242a Mon Sep 17 00:00:00 2001 From: Adrien Ufferte Date: Fri, 6 Feb 2026 14:02:44 +0100 Subject: [PATCH] Boss minigame feedbacks --- sources/minigames/ants/ant.gd | 9 + sources/minigames/ants/ant.tscn | 2 +- sources/minigames/boss/boss_minigame.gd | 113 +++++++++++- sources/minigames/boss/boss_minigame.tscn | 166 ++++++++++++++---- sources/minigames/boss/kalulu_boss.gd | 2 +- sources/minigames/boss/kalulu_boss.tscn | 2 + sources/minigames/crabs/crab/crab.gd | 11 +- sources/minigames/frog/frog.gd | 9 + sources/minigames/frog/river.gd | 1 - sources/minigames/jellyfish/jellyfish.gd | 87 ++++++--- sources/minigames/jellyfish/jellyfish.tscn | 16 +- sources/minigames/monkeys/monkey.gd | 11 +- sources/minigames/parakeets/parakeet.gd | 11 ++ sources/minigames/parakeets/parakeet.tscn | 4 +- .../parakeets/parakeets_minigame.tscn | 2 +- sources/minigames/penguin/penguin.gd | 8 + sources/minigames/turtles/turtle.gd | 8 + sources/minigames/turtles/turtle.tscn | 3 +- .../parakeets => utils}/clouds_manager.gd | 0 .../parakeets => utils}/clouds_manager.gd.uid | 0 sources/utils/sprite_control.gd | 1 - 21 files changed, 383 insertions(+), 83 deletions(-) rename sources/{minigames/parakeets => utils}/clouds_manager.gd (100%) rename sources/{minigames/parakeets => utils}/clouds_manager.gd.uid (100%) diff --git a/sources/minigames/ants/ant.gd b/sources/minigames/ants/ant.gd index 0feca6c4..e0ba02a3 100644 --- a/sources/minigames/ants/ant.gd +++ b/sources/minigames/ants/ant.gd @@ -24,3 +24,12 @@ func defeat() -> void: animated_sprite_2d.play_backwards("defeat") await animated_sprite_2d.animation_finished idle() + + +func idle_boss() -> void: + animated_sprite_2d.play("idle") + animated_sprite_2d.stop() + + +func victory_boss() -> void: + animated_sprite_2d.play("success") diff --git a/sources/minigames/ants/ant.tscn b/sources/minigames/ants/ant.tscn index 400ca939..18ffdf35 100644 --- a/sources/minigames/ants/ant.tscn +++ b/sources/minigames/ants/ant.tscn @@ -18,7 +18,7 @@ shape = SubResource("RectangleShape2D_100ls") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=889635559] position = Vector2(1, -90.5) sprite_frames = ExtResource("2_rcd7x") -animation = &"defeat" +animation = &"idle" autoplay = "idle" [node name="Anchor" type="Marker2D" parent="." unique_id=744855349] diff --git a/sources/minigames/boss/boss_minigame.gd b/sources/minigames/boss/boss_minigame.gd index 63203678..ccc5b336 100644 --- a/sources/minigames/boss/boss_minigame.gd +++ b/sources/minigames/boss/boss_minigame.gd @@ -18,6 +18,7 @@ var _boss_session_index: int = -1 var _boss_answer_start_ms: int = 0 var default_label_settings: LabelSettings var default_label_background_color: Color +var _correct_answer_tween: Tween @onready var text_start_zone: Control = %ControlText @onready var texture_button_bin: TextureButton = $GameRoot/TextureButtonBin @@ -32,10 +33,23 @@ var default_label_background_color: Color @onready var kalulu_boss: KaluluBoss = %KaluluBoss @onready var wrong_fx: WrongFX = %WrongFX @onready var right_stars: RightStarsFX = $GameRoot/Right_Stars +@onready var frame_exit: Sprite2D = $GameRoot/Frame/FrameExit +@onready var turtle: Turtle = $GameRoot/Friends/Turtle +@onready var frog: Frog = $GameRoot/Friends/Frog +@onready var crab: Crab = $GameRoot/Friends/Crab +@onready var penguin: Penguin = $GameRoot/Friends/Penguin +@onready var monkey: Monkey = $GameRoot/Friends/Monkey +@onready var parakeet: Parakeet = $GameRoot/Friends/Parakeet +@onready var ant: Ant = $GameRoot/Friends/Ant +@onready var jellyfish: Jellyfish = $GameRoot/Friends_Behind_Frame/Jellyfish func _ready() -> void: super() + if not is_final_boss: + frame_exit.show() + setup_animal_friends() + fireworks.set_colors([Color("#bca4ff"), Color("#f5a8c8"), Color("#ffbf94")]) if adult_block and adult_block.has_signal("unlocked"): adult_block.unlocked.connect(_on_adult_block_unlocked) text_start_zone.set_drag_forwarding(_text_get_drag_data, Callable(), Callable()) @@ -55,6 +69,28 @@ func _ready() -> void: tutorial_count = 2 +func setup_animal_friends() -> void: + turtle.idle_boss() + frog.idle_boss() + crab.idle_boss() + penguin.idle_boss() + monkey.idle_boss() + parakeet.idle_boss() + ant.idle_boss() + jellyfish.idle_boss() + + +func win_with_friends() -> void: + turtle.victory_boss() + frog.victory_boss() + crab.victory_boss() + penguin.victory_boss() + monkey.victory_boss() + parakeet.victory_boss() + ant.victory_boss() + jellyfish.victory_boss() + + func _text_get_drag_data(_at_position: Vector2) -> Variant: var duplicated: Control = text_start_zone.duplicate() duplicated.set_scale(Vector2(0.6, 0.6)) @@ -109,7 +145,10 @@ func _start() -> void: func _present_next_word() -> void: if words_to_present.is_empty(): if words_to_present_next.is_empty(): - _win() + if _get_win_ratio() >= minimum_correct_ratio: + _win() + else: + _lose() return words_to_present = words_to_present_next words_to_present.shuffle() @@ -175,6 +214,7 @@ func _on_answer_dropped(is_answered_real: bool) -> void: label.label_settings = label.label_settings.duplicate() label.label_settings.font_color = Minigame.LABEL_COLOR_NEUTRAL texture_rect_text_box.self_modulate = Minigame.LABEL_COLOR_WIN + var target_button: Control = texture_button_book if is_answered_real else texture_button_bin if is_answered_real: right_stars.global_position = texture_button_book.global_position + texture_button_book.get_size() / 2 right_stars.replay() @@ -182,6 +222,7 @@ func _on_answer_dropped(is_answered_real: bool) -> void: right_stars.global_position = texture_button_bin.global_position + texture_button_bin.get_size() / 2 right_stars.replay() words_to_present.pop_front() + await _play_correct_answer_animation(target_button) if tutorial_count == 0: var speech: AudioStreamMP3 = Database.load_external_sound(Database.get_kalulu_speech_path(Type.keys()[minigame_name] as String, "win_test_game_first_word")) minigame_ui.play_kalulu_speech(speech) @@ -193,6 +234,9 @@ func _on_answer_dropped(is_answered_real: bool) -> void: await minigame_ui.kalulu_speech_ended tutorial_count += 1 else: + label.label_settings = label.label_settings.duplicate() + label.label_settings.font_color = Minigame.LABEL_COLOR_NEUTRAL + texture_rect_text_box.self_modulate = Minigame.LABEL_COLOR_LOSE if is_answered_real: wrong_fx.global_position = texture_button_book.global_position + texture_button_book.get_size() / 2 wrong_fx.play() @@ -217,6 +261,72 @@ func _on_answer_dropped(is_answered_real: bool) -> void: texture_button_book.set_disabled(false) _update_progression_gauge() _present_next_word() + text_start_zone.show() + + +func _center_global(control: Control) -> Vector2: + var rect: Rect2 = control.get_global_rect() + var scaled_half: Vector2 = (rect.size * control.scale) * 0.5 + return rect.position + scaled_half + + +func _play_correct_answer_animation(target_button: Control) -> void: + if not is_instance_valid(text_start_zone) or not is_instance_valid(target_button): + return + + if _correct_answer_tween and _correct_answer_tween.is_running(): + _correct_answer_tween.kill() + + var duplicated: Control = text_start_zone.duplicate() + + if text_start_zone.is_visible_in_tree(): + text_start_zone.hide() + else: + duplicated.show() + + duplicated.name = "CorrectAnswerWord" + duplicated.mouse_filter = Control.MOUSE_FILTER_IGNORE + + # Place duplicated so that its center matches the original center. + # (We set position after adding as child to ensure layout/size is correct) + text_start_zone.get_parent().add_child(duplicated) + duplicated.scale = text_start_zone.scale + + # Force layout to be up-to-date (helps if sizes depend on theme/text) + duplicated.queue_redraw() + duplicated.minimum_size_changed.emit() + + var start_center: Vector2 = _center_global(text_start_zone) + var end_center: Vector2 = _center_global(target_button) + + # Initialize duplicated at start center + var dup_half: Vector2 = duplicated.size * duplicated.scale * 0.5 + duplicated.global_position = start_center - dup_half + + var arc_height: float = max(200.0, start_center.distance_to(end_center) * 0.5) + var control_position: Vector2 = (start_center + end_center) * 0.5 + Vector2(0.0, -arc_height) + + _correct_answer_tween = create_tween() + _correct_answer_tween.tween_method( + func(progress: float) -> void: + var new_center: Vector2 = _quadratic_bezier(start_center, control_position, end_center, progress) + var half: Vector2 = duplicated.size * duplicated.scale * 0.5 + duplicated.global_position = new_center - half + duplicated.scale = text_start_zone.scale.lerp(Vector2(0.2, 0.2), progress), + 0.0, + 1.0, + 0.6 + ).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT) + + await _correct_answer_tween.finished + + if is_instance_valid(duplicated): + duplicated.queue_free() + + +func _quadratic_bezier(start: Vector2, control: Vector2, end: Vector2, progress: float) -> Vector2: + var one_minus: float = 1.0 - progress + return one_minus * one_minus * start + 2.0 * one_minus * progress * control + progress * progress * end func _update_progression_gauge() -> void: @@ -252,6 +362,7 @@ func _on_adult_block_unlocked() -> void: func _win() -> void: if _is_boss_session() and _boss_session_index >= 0: UserDataManager.finish_boss_session(_boss_session_index, true) + win_with_friends() await kalulu_boss.happy() await super() diff --git a/sources/minigames/boss/boss_minigame.tscn b/sources/minigames/boss/boss_minigame.tscn index b266ee86..c41dca8d 100644 --- a/sources/minigames/boss/boss_minigame.tscn +++ b/sources/minigames/boss/boss_minigame.tscn @@ -4,10 +4,15 @@ [ext_resource type="Script" uid="uid://dgodk76761a1n" path="res://sources/minigames/boss/boss_minigame.gd" id="2_68jip"] [ext_resource type="Texture2D" uid="uid://ccfocxdqxujvc" path="res://assets/minigames/boss/background.png" id="3_3ty3i"] [ext_resource type="Texture2D" uid="uid://bf7od6f56f516" path="res://assets/minigames/boss/sun.png" id="4_2m0ff"] +[ext_resource type="Script" uid="uid://cgtd34f7vi2tj" path="res://sources/utils/clouds_manager.gd" id="5_rl4hv"] [ext_resource type="Texture2D" uid="uid://bk4k8v5yrolt1" path="res://assets/minigames/boss/frame_corner.png" id="5_xo63t"] [ext_resource type="Texture2D" uid="uid://2iib006wpkux" path="res://assets/minigames/boss/frame_side.png" id="6_2c6ay"] +[ext_resource type="Texture2D" uid="uid://rx270y4n7tul" path="res://assets/minigames/parakeets/graphic/cloud_1.png" id="6_je4of"] +[ext_resource type="Texture2D" uid="uid://dphj3hqfnnw4p" path="res://assets/minigames/parakeets/graphic/cloud_2.png" id="7_bba1f"] [ext_resource type="Texture2D" uid="uid://cax5nncivwq4" path="res://assets/minigames/boss/bin.png" id="7_wij1o"] [ext_resource type="Texture2D" uid="uid://xukdk8dobsqy" path="res://assets/minigames/boss/book.png" id="8_mkvne"] +[ext_resource type="Texture2D" uid="uid://1btgagsporxa" path="res://assets/minigames/parakeets/graphic/cloud_3.png" id="8_xrsj0"] +[ext_resource type="PackedScene" uid="uid://djykrpdu58f3v" path="res://sources/minigames/turtles/turtle.tscn" id="11_je4of"] [ext_resource type="Texture2D" uid="uid://dxqnvbr4tffn7" path="res://assets/minigames/minigame_ui/graphic/gauge.png" id="11_p5wnc"] [ext_resource type="Texture2D" uid="uid://7w2e4mo7yssm" path="res://assets/minigames/boss/foreground.png" id="12_2c6ay"] [ext_resource type="Texture2D" uid="uid://4ci6gmg0c15o" path="res://assets/minigames/minigame_ui/graphic/white_gauge.png" id="12_w5m1b"] @@ -17,9 +22,15 @@ [ext_resource type="LabelSettings" uid="uid://bguqnhiblwick" path="res://resources/themes/minigames_label_settings.tres" id="17_47luc"] [ext_resource type="PackedScene" uid="uid://dpfn2ag2xv24s" path="res://sources/minigames/boss/kalulu_boss.tscn" id="17_kvjsk"] [ext_resource type="PackedScene" uid="uid://b7rx6esglyd6c" path="res://sources/menus/adult_block/adult_block.tscn" id="18_4v0wd"] -[ext_resource type="Texture2D" uid="uid://cobv0mceg2vb8" path="res://assets/minigames/boss/friends.png" id="18_kvjsk"] +[ext_resource type="PackedScene" uid="uid://bp0b4xkr7nwed" path="res://sources/minigames/monkeys/monkey.tscn" id="18_y0mix"] [ext_resource type="PackedScene" uid="uid://cs6g7fhc0bjvh" path="res://sources/utils/fx/right_stars.tscn" id="19_b2wqe"] +[ext_resource type="PackedScene" uid="uid://b78362g1yif2n" path="res://sources/minigames/penguin/penguin.tscn" id="19_j0ia3"] [ext_resource type="PackedScene" uid="uid://dlmbxcgiv8tpr" path="res://sources/utils/fx/wrong.tscn" id="19_wi3c5"] +[ext_resource type="PackedScene" uid="uid://bwe3fp0vkpufb" path="res://sources/minigames/crabs/crab/crab.tscn" id="20_j0ia3"] +[ext_resource type="PackedScene" uid="uid://bloyucpsbvpx8" path="res://sources/minigames/frog/frog.tscn" id="20_xrsj0"] +[ext_resource type="PackedScene" uid="uid://cpkwyypyikpfc" path="res://sources/minigames/jellyfish/jellyfish.tscn" id="21_3iy22"] +[ext_resource type="PackedScene" uid="uid://cmoeum0oc0p2" path="res://sources/minigames/parakeets/parakeet.tscn" id="23_h2hey"] +[ext_resource type="PackedScene" uid="uid://c6st16roxwloh" path="res://sources/minigames/ants/ant.tscn" id="24_ejade"] [sub_resource type="Curve2D" id="Curve2D_8d1qx"] _data = { @@ -27,7 +38,7 @@ _data = { } point_count = 2 -[node name="FishMinigame" unique_id=1178378052 instance=ExtResource("1_itrpi")] +[node name="BossMinigame" unique_id=1178378052 instance=ExtResource("1_itrpi")] script = ExtResource("2_68jip") game_duration = 240 minimum_correct_ratio = 0.8 @@ -61,7 +72,35 @@ loop = false [node name="Sprite2DSun" type="Sprite2D" parent="GameRoot/Path2D/PathFollow2D" index="0" unique_id=2147097806] texture = ExtResource("4_2m0ff") -[node name="Frame" type="Node2D" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="2" unique_id=1674444498] +[node name="Clouds_Background" type="Node2D" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="2" unique_id=1520455712] +script = ExtResource("5_rl4hv") +max_speed = 40.0 +min_y = 100.0 +max_y = 500.0 + +[node name="cloud_1" type="Sprite2D" parent="GameRoot/Clouds_Background" index="0" unique_id=41424144] +position = Vector2(623, 253.5) +texture = ExtResource("6_je4of") + +[node name="cloud_2" type="Sprite2D" parent="GameRoot/Clouds_Background" index="1" unique_id=1350923133] +position = Vector2(1088, 256) +texture = ExtResource("7_bba1f") + +[node name="cloud_3" type="Sprite2D" parent="GameRoot/Clouds_Background" index="2" unique_id=190014762] +position = Vector2(1904, 248) +texture = ExtResource("8_xrsj0") + +[node name="Friends_Behind_Frame" type="Node2D" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="3" unique_id=889769498] + +[node name="Jellyfish" parent="GameRoot/Friends_Behind_Frame" index="0" unique_id=2036427610 instance=ExtResource("21_3iy22")] +offset_left = 1449.0001 +offset_top = 1301.0001 +offset_right = 1849.0001 +offset_bottom = 1701.0001 +scale = Vector2(0.45, 0.45) +boss = true + +[node name="Frame" type="Node2D" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="4" unique_id=1674444498] position = Vector2(1080, 720) scale = Vector2(0.9, 0.9) @@ -105,16 +144,48 @@ rotation = 1.5707964 scale = Vector2(1, 1.6) texture = ExtResource("6_2c6ay") -[node name="TextureButtonBin" type="TextureButton" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="3" unique_id=852671648] +[node name="FrameExit" type="Sprite2D" parent="GameRoot/Frame" index="8" unique_id=1578271912] +visible = false +position = Vector2(1546.6666, 195.55557) +rotation = 1.5707964 +scale = Vector2(1, 1.6) +texture = ExtResource("6_2c6ay") + +[node name="FrameEnter" type="Sprite2D" parent="GameRoot/Frame" index="9" unique_id=1113523446] +position = Vector2(-1013.3334, 195.55557) +rotation = 1.5707964 +scale = Vector2(1, 1.6) +texture = ExtResource("6_2c6ay") + +[node name="Clouds_Foreground" type="Node2D" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="5" unique_id=2116541314] +script = ExtResource("5_rl4hv") +min_speed = 50.0 +max_speed = 80.0 +min_y = 100.0 +max_y = 500.0 + +[node name="cloud_1" type="Sprite2D" parent="GameRoot/Clouds_Foreground" index="0" unique_id=1134925507] +position = Vector2(623, 253.5) +texture = ExtResource("6_je4of") + +[node name="cloud_2" type="Sprite2D" parent="GameRoot/Clouds_Foreground" index="1" unique_id=392578643] +position = Vector2(1088, 256) +texture = ExtResource("7_bba1f") + +[node name="cloud_3" type="Sprite2D" parent="GameRoot/Clouds_Foreground" index="2" unique_id=1502196887] +position = Vector2(1904, 248) +texture = ExtResource("8_xrsj0") + +[node name="TextureButtonBin" type="TextureButton" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="6" unique_id=852671648] layout_mode = 0 offset_left = 320.0 offset_top = 768.0 -offset_right = 320.0 -offset_bottom = 768.0 +offset_right = 561.0 +offset_bottom = 1020.0 mouse_default_cursor_shape = 2 texture_normal = ExtResource("7_wij1o") -[node name="TextureButtonBook" type="TextureButton" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="4" unique_id=22079276] +[node name="TextureButtonBook" type="TextureButton" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="7" unique_id=22079276] layout_mode = 0 offset_left = 2064.0 offset_top = 768.0 @@ -123,7 +194,7 @@ offset_bottom = 768.0 mouse_default_cursor_shape = 2 texture_normal = ExtResource("8_mkvne") -[node name="ProgressionGauge" type="NinePatchRect" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="5" unique_id=1664248446] +[node name="ProgressionGauge" type="NinePatchRect" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="8" unique_id=1664248446] unique_name_in_owner = true custom_minimum_size = Vector2(64, 64) layout_mode = 0 @@ -171,21 +242,56 @@ texture = ExtResource("12_w5m1b") patch_margin_top = 33 patch_margin_bottom = 33 -[node name="Foreground" type="Sprite2D" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="6" unique_id=942294228] +[node name="Foreground" type="Sprite2D" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="9" unique_id=942294228] top_level = true position = Vector2(1872, 424) texture = ExtResource("12_2c6ay") -[node name="Friends" type="Sprite2D" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="7" unique_id=888328201] +[node name="Friends" type="Node2D" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="10" unique_id=1965227465] +self_modulate = Color(1, 1, 1, 0.34509805) position = Vector2(1676, 1280) -texture = ExtResource("18_kvjsk") -[node name="KaluluBoss" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="8" unique_id=1776395621 instance=ExtResource("17_kvjsk")] +[node name="Monkey" parent="GameRoot/Friends" index="0" unique_id=1341983060 instance=ExtResource("18_y0mix")] +position = Vector2(125, 62) +scale = Vector2(0.7, 0.7) + +[node name="Turtle" parent="GameRoot/Friends" index="1" unique_id=711306409 instance=ExtResource("11_je4of")] +position = Vector2(-220, 120) +rotation = 1.5707964 +scale = Vector2(0.17999999, 0.17999999) + +[node name="Penguin" parent="GameRoot/Friends" index="2" unique_id=1835464943 instance=ExtResource("19_j0ia3")] +position = Vector2(28, 104) +scale = Vector2(0.3, 0.3) + +[node name="Frog" parent="GameRoot/Friends" index="3" unique_id=2020692812 instance=ExtResource("20_xrsj0")] +offset_left = -43.999985 +offset_top = 112.0 +offset_right = -43.999985 +offset_bottom = 112.0 +scale = Vector2(0.4, 0.4) + +[node name="Crab" parent="GameRoot/Friends" index="4" unique_id=617305983 instance=ExtResource("20_j0ia3")] +offset_left = -220.0 +offset_top = 32.0 +offset_right = 148.0 +offset_bottom = 352.0 +scale = Vector2(0.45, 0.45) + +[node name="Parakeet" parent="GameRoot/Friends" index="5" unique_id=1132826004 instance=ExtResource("23_h2hey")] +position = Vector2(124, -103) +scale = Vector2(0.09, 0.09) + +[node name="Ant" parent="GameRoot/Friends" index="6" unique_id=1721368901 instance=ExtResource("24_ejade")] +position = Vector2(228, 128) +scale = Vector2(0.17, 0.17) + +[node name="KaluluBoss" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="11" unique_id=1776395621 instance=ExtResource("17_kvjsk")] unique_name_in_owner = true position = Vector2(800, 1224) scale = Vector2(0.7, 0.7) -[node name="ControlText" type="Control" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="9" unique_id=95008625] +[node name="ControlText" type="Control" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="12" unique_id=95008625] unique_name_in_owner = true custom_minimum_size = Vector2(1025, 234) anchors_preset = 0 @@ -204,40 +310,30 @@ stretch_mode = 2 [node name="TextureRectTextBox" type="TextureRect" parent="GameRoot/ControlText/TextureRectOutlineDotted" index="0" unique_id=1202683105] unique_name_in_owner = true +self_modulate = Color(0.99607843, 0.96862745, 0.8666667, 1) layout_mode = 0 -offset_left = 32.0 -offset_top = 24.0 -offset_right = 1056.0 -offset_bottom = 257.0 +offset_right = 1024.0 +offset_bottom = 233.0 texture = ExtResource("16_sndot") -stretch_mode = 2 +stretch_mode = 3 -[node name="MarginContainer" type="MarginContainer" parent="GameRoot/ControlText/TextureRectOutlineDotted/TextureRectTextBox" index="0" unique_id=415001204] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = -24.0 -offset_top = -32.0 -offset_right = -24.0 -offset_bottom = -19.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/margin_right = 30 - -[node name="Label" type="Label" parent="GameRoot/ControlText/TextureRectOutlineDotted/TextureRectTextBox/MarginContainer" index="0" unique_id=1229572097] +[node name="Label" type="Label" parent="GameRoot/ControlText/TextureRectOutlineDotted/TextureRectTextBox" index="0" unique_id=1229572097] unique_name_in_owner = true -layout_mode = 2 +layout_mode = 0 +offset_top = 11.0 +offset_right = 1024.0 +offset_bottom = 212.0 theme_override_font_sizes/font_size = 100 text = "abc" label_settings = ExtResource("17_47luc") horizontal_alignment = 1 +vertical_alignment = 1 -[node name="WrongFX" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="10" unique_id=81753671 instance=ExtResource("19_wi3c5")] +[node name="WrongFX" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="13" unique_id=81753671 instance=ExtResource("19_wi3c5")] unique_name_in_owner = true layout_mode = 0 -[node name="Right_Stars" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="11" unique_id=749307022 instance=ExtResource("19_b2wqe")] +[node name="Right_Stars" parent="GameRoot" parent_id_path=PackedInt32Array(1053321881) index="14" unique_id=749307022 instance=ExtResource("19_b2wqe")] [node name="AdultBlock" parent="." index="4" unique_id=1401891944 instance=ExtResource("18_4v0wd")] unique_name_in_owner = true diff --git a/sources/minigames/boss/kalulu_boss.gd b/sources/minigames/boss/kalulu_boss.gd index 51e73d88..404b4761 100644 --- a/sources/minigames/boss/kalulu_boss.gd +++ b/sources/minigames/boss/kalulu_boss.gd @@ -22,7 +22,7 @@ func sad() -> void: play("idle_1") -func _on_animated_sprite_2d_animation_finished() -> void: +func _on_animation_finished() -> void: match animation: "idle_1": animation_counter -= 1 diff --git a/sources/minigames/boss/kalulu_boss.tscn b/sources/minigames/boss/kalulu_boss.tscn index 3968a8d7..509a9d1e 100644 --- a/sources/minigames/boss/kalulu_boss.tscn +++ b/sources/minigames/boss/kalulu_boss.tscn @@ -8,3 +8,5 @@ sprite_frames = ExtResource("1_u7krp") animation = &"idle_1" autoplay = "idle_1" script = ExtResource("2_46epb") + +[connection signal="animation_finished" from="." to="." method="_on_animation_finished"] diff --git a/sources/minigames/crabs/crab/crab.gd b/sources/minigames/crabs/crab/crab.gd index 85aa63d0..c3805773 100644 --- a/sources/minigames/crabs/crab/crab.gd +++ b/sources/minigames/crabs/crab/crab.gd @@ -1,4 +1,3 @@ -@tool class_name Crab extends Control @@ -108,3 +107,13 @@ func _on_animated_sprite_2d_animation_finished() -> void: func _on_audio_stream_player_finished() -> void: audio_stream_player.stream = sounds[randi_range(0, sounds.size() - 1)] audio_stream_player.play() + + +func idle_boss() -> void: + text_box_sprite_2d.hide() + animated_sprite.play("idle") + animated_sprite.stop() + + +func victory_boss() -> void: + animated_sprite.play("right") diff --git a/sources/minigames/frog/frog.gd b/sources/minigames/frog/frog.gd index e0b2de2e..7541f1d5 100644 --- a/sources/minigames/frog/frog.gd +++ b/sources/minigames/frog/frog.gd @@ -127,3 +127,12 @@ func _on_animated_sprite_2d_animation_finished() -> void: jumped.emit() "defeat": defeated.emit() + + +func idle_boss() -> void: + animated_sprite.play("idle_front") + animated_sprite.stop() + + +func victory_boss() -> void: + animated_sprite.play("idle_front") diff --git a/sources/minigames/frog/river.gd b/sources/minigames/frog/river.gd index 8f11f31e..511bf270 100644 --- a/sources/minigames/frog/river.gd +++ b/sources/minigames/frog/river.gd @@ -1,4 +1,3 @@ -@tool class_name River extends TextureRect diff --git a/sources/minigames/jellyfish/jellyfish.gd b/sources/minigames/jellyfish/jellyfish.gd index a88f1bbb..5d61e4fc 100644 --- a/sources/minigames/jellyfish/jellyfish.gd +++ b/sources/minigames/jellyfish/jellyfish.gd @@ -1,12 +1,11 @@ -@tool class_name Jellyfish extends Control signal pressed(stimulus: Dictionary) enum Colors { - Red, - Green, + Blue, + Pink, } const ANIMATIONS_BODY: Array[SpriteFrames] = [ @@ -18,35 +17,31 @@ const ANIMATIONS_ARMS: Array[SpriteFrames] = [ preload("res://sources/minigames/jellyfish/pink_jellyfish_animations_arms.tres"), ] const SCALES: Array[Vector2] = [ - Vector2(1.,1.), - Vector2(1.25, 1.25) + Vector2(1.0, 1.0), + Vector2(1.25, 1.25), ] const SCALE_FACTOR: float = 0.2 -@export var color: int = Colors.Red: +@export var boss: bool = false: set(value): - color = value - if animated_sprite_body: - animated_sprite_body.sprite_frames = ANIMATIONS_BODY[color] - else: - Log.error("Jellyfish: no animated sprite body") - if animated_sprite_arms: - animated_sprite_arms.sprite_frames = ANIMATIONS_ARMS[color] - else: - Log.error("Jellyfish: no animated sprite arms") - scale = SCALES[color] * (1. + randf() * SCALE_FACTOR) - - # Handles sprite size - sprite_control.resized.emit() + boss = value + if is_node_ready(): + _apply_visuals() -var stimulus: Dictionary = {}: +var _color: int = Colors.Blue +var color: int: + get: return _color set(value): - stimulus = value - if label: - if value.has("Grapheme"): - label.text = value.Grapheme - else: - label.text = "" + _color = value + if is_node_ready(): + _apply_visuals() +var _stimulus: Dictionary = {} +var stimulus: Dictionary: + get: return _stimulus + set(value): + _stimulus = value + if is_node_ready(): + _apply_label() @onready var sprite_control: SpriteControl = $SpriteControl @onready var animated_sprite_body: AnimatedSprite2D = %AnimatedSprite2D_Body @@ -60,16 +55,38 @@ var stimulus: Dictionary = {}: func _ready() -> void: - stimulus = stimulus - + _apply_visuals() + _apply_label() + + if boss: + return + var rand: float = randf() - color = Colors.Red if rand < 0.7 else Colors.Green + color = Colors.Blue if rand < 0.7 else Colors.Pink var rand_frame: int = randi_range(0, animated_sprite_body.sprite_frames.get_frame_count("idle") - 1) animated_sprite_body.frame = rand_frame animated_sprite_arms.frame = rand_frame idle() +func _apply_visuals() -> void: + if boss: + animated_sprite_body.sprite_frames = ANIMATIONS_BODY[Colors.Pink] + animated_sprite_arms.hide() + return + else: + animated_sprite_arms.show() + + animated_sprite_body.sprite_frames = ANIMATIONS_BODY[_color] + animated_sprite_arms.sprite_frames = ANIMATIONS_ARMS[_color] + scale = SCALES[_color] * (1.0 + randf() * SCALE_FACTOR) + sprite_control.resized.emit() + + +func _apply_label() -> void: + label.text = str(_stimulus.get("Grapheme", "")) + + func is_idle() -> bool: return animated_sprite_body.animation == "idle" @@ -126,3 +143,15 @@ func delete() -> void: tween.tween_property(self, "modulate:a", 0, 2) await tween.finished queue_free() + + +func idle_boss() -> void: + text_box_sprite_2d.hide() + color = Colors.Pink + scale = Vector2(0.45, 0.45) + animated_sprite_body.stop() + animated_sprite_arms.stop() + + +func victory_boss() -> void: + animated_sprite_arms.play("happy") diff --git a/sources/minigames/jellyfish/jellyfish.tscn b/sources/minigames/jellyfish/jellyfish.tscn index cec65d0c..382b483c 100644 --- a/sources/minigames/jellyfish/jellyfish.tscn +++ b/sources/minigames/jellyfish/jellyfish.tscn @@ -7,10 +7,10 @@ [ext_resource type="Script" uid="uid://d5qkkg88431w" path="res://sources/utils/percent_margin_container.gd" id="3_vllju"] [ext_resource type="PackedScene" uid="uid://bgio7muqck2bu" path="res://sources/utils/auto_size_label.tscn" id="4_26xiq"] [ext_resource type="Texture2D" uid="uid://c34sgkbvr3h8q" path="res://assets/minigames/minigame_ui/graphic/primary_text_box.png" id="6_ah5ir"] -[ext_resource type="SpriteFrames" uid="uid://033w5t1wyg3w" path="res://sources/minigames/jellyfish/blue_jellyfish_animations_arms.tres" id="6_i86t4"] -[ext_resource type="SpriteFrames" uid="uid://cyllu3lpjcxej" path="res://sources/minigames/jellyfish/blue_jellyfish_animations_body.tres" id="6_p6hdi"] +[ext_resource type="SpriteFrames" uid="uid://dijfxjt76waan" path="res://sources/minigames/jellyfish/pink_jellyfish_animations_body.tres" id="6_jfr88"] [ext_resource type="PackedScene" uid="uid://dlmbxcgiv8tpr" path="res://sources/utils/fx/wrong.tscn" id="6_w1tlu"] [ext_resource type="LabelSettings" uid="uid://bguqnhiblwick" path="res://resources/themes/minigames_label_settings.tres" id="9_ah5ir"] +[ext_resource type="SpriteFrames" uid="uid://cu631qur8h6sj" path="res://sources/minigames/jellyfish/pink_jellyfish_animations_arms.tres" id="11_4yskd"] [ext_resource type="PackedScene" uid="uid://cs6g7fhc0bjvh" path="res://sources/utils/fx/right_stars.tscn" id="13_jfr88"] [node name="Jellyfish" type="Control" unique_id=2036427610] @@ -19,8 +19,9 @@ layout_mode = 3 anchors_preset = 0 offset_right = 400.0 offset_bottom = 400.0 -scale = Vector2(1.157944, 1.157944) +scale = Vector2(1.2724898, 1.2724898) script = ExtResource("1_06uwq") +color = 1 [node name="BackFX" type="Control" parent="." unique_id=880451279] custom_minimum_size = Vector2(0, 220) @@ -82,9 +83,9 @@ sprites = [NodePath("AnimatedSprite2D_Body"), NodePath("AnimatedSprite2D_Arms")] [node name="AnimatedSprite2D_Body" type="AnimatedSprite2D" parent="SpriteControl" unique_id=220917894] unique_name_in_owner = true scale = Vector2(0.5, 0.5) -sprite_frames = ExtResource("6_p6hdi") +sprite_frames = ExtResource("6_jfr88") animation = &"idle" -frame_progress = 0.33819497 +frame_progress = 0.7250104 centered = false offset = Vector2(-0.000205994, 0.00019455) @@ -117,7 +118,7 @@ layout_mode = 2 unique_name_in_owner = true layout_mode = 2 -[node name="Label" parent="SpriteControl/TextBox_Sprite2D/PercentMarginContainer/AspectRatioContainer/AutoSizeLabel" index="0"] +[node name="Label" parent="SpriteControl/TextBox_Sprite2D/PercentMarginContainer/AspectRatioContainer/AutoSizeLabel" index="0" unique_id=1172353947] theme_override_colors/font_color = Color(0, 0, 0, 1) text = "" label_settings = ExtResource("9_ah5ir") @@ -125,8 +126,9 @@ label_settings = ExtResource("9_ah5ir") [node name="AnimatedSprite2D_Arms" type="AnimatedSprite2D" parent="SpriteControl" unique_id=1825015543] unique_name_in_owner = true scale = Vector2(0.5, 0.5) -sprite_frames = ExtResource("6_i86t4") +sprite_frames = ExtResource("11_4yskd") animation = &"idle" +frame_progress = 0.7250104 centered = false offset = Vector2(-0.000205994, 0.00019455) diff --git a/sources/minigames/monkeys/monkey.gd b/sources/minigames/monkeys/monkey.gd index 2bc6a292..16c7a937 100644 --- a/sources/minigames/monkeys/monkey.gd +++ b/sources/minigames/monkeys/monkey.gd @@ -1,4 +1,3 @@ -@tool class_name Monkey extends Node2D @@ -133,3 +132,13 @@ func _drop_data(_at_position: Vector2, data: Dictionary) -> void: func _on_drag_preview_tree_exiting() -> void: coconut.show() + + +func idle_boss() -> void: + animated_sprite_2d.play("idle") + animated_sprite_2d.stop() + coconut.hide() + + +func victory_boss() -> void: + animated_sprite_2d.play("idle") diff --git a/sources/minigames/parakeets/parakeet.gd b/sources/minigames/parakeets/parakeet.gd index 7eff7992..c9569cc3 100644 --- a/sources/minigames/parakeets/parakeet.gd +++ b/sources/minigames/parakeets/parakeet.gd @@ -135,3 +135,14 @@ func wrong() -> void: text_box_sprite_2d.self_modulate = Minigame.LABEL_COLOR_NEUTRAL wrong_fx.play() await wrong_fx.finished + + +func idle_boss() -> void: + text_box_sprite_2d.hide() + color = Colors.Green + animated_sprite.play("idle_front") + animated_sprite.stop() + + +func victory_boss() -> void: + animated_sprite.play("happy") diff --git a/sources/minigames/parakeets/parakeet.tscn b/sources/minigames/parakeets/parakeet.tscn index 5cff21aa..9f4b0872 100644 --- a/sources/minigames/parakeets/parakeet.tscn +++ b/sources/minigames/parakeets/parakeet.tscn @@ -71,7 +71,7 @@ layout_mode = 2 unique_name_in_owner = true layout_mode = 2 -[node name="Label" parent="TextBox_Sprite2D/PercentMarginContainer/AspectRatioContainer/AutoSizeLabel" index="0"] +[node name="Label" parent="TextBox_Sprite2D/PercentMarginContainer/AspectRatioContainer/AutoSizeLabel" index="0" unique_id=1172353947] theme_override_colors/font_color = Color(0, 0, 0, 1) text = "" label_settings = SubResource("LabelSettings_thibt") @@ -79,7 +79,7 @@ label_settings = SubResource("LabelSettings_thibt") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1157745331] scale = Vector2(2, 2) sprite_frames = ExtResource("2_k0dcm") -animation = &"sad" +animation = &"idle_front" autoplay = "idle_front" offset = Vector2(2.08165e-12, -82) diff --git a/sources/minigames/parakeets/parakeets_minigame.tscn b/sources/minigames/parakeets/parakeets_minigame.tscn index 2a03290f..ced3f2b3 100644 --- a/sources/minigames/parakeets/parakeets_minigame.tscn +++ b/sources/minigames/parakeets/parakeets_minigame.tscn @@ -7,7 +7,7 @@ [ext_resource type="Texture2D" uid="uid://pj0mlw24jayt" path="res://assets/minigames/parakeets/graphic/background_2.png" id="6_6ktwy"] [ext_resource type="Texture2D" uid="uid://di2qcv6jw8wh0" path="res://assets/minigames/parakeets/graphic/gauge_icon_parakeet_full.png" id="6_46vnr"] [ext_resource type="Texture2D" uid="uid://cs16kbsvnsltg" path="res://assets/minigames/parakeets/graphic/background_3.png" id="7_k6xou"] -[ext_resource type="Script" uid="uid://cgtd34f7vi2tj" path="res://sources/minigames/parakeets/clouds_manager.gd" id="8_cy1rn"] +[ext_resource type="Script" uid="uid://cgtd34f7vi2tj" path="res://sources/utils/clouds_manager.gd" id="8_cy1rn"] [ext_resource type="Texture2D" uid="uid://0p171y6thba8" path="res://assets/minigames/parakeets/graphic/tree.png" id="8_g6pid"] [ext_resource type="Texture2D" uid="uid://ca2jljrk2wnjt" path="res://assets/minigames/parakeets/graphic/nest.png" id="9_0u6jo"] [ext_resource type="Texture2D" uid="uid://rx270y4n7tul" path="res://assets/minigames/parakeets/graphic/cloud_1.png" id="9_6ktwy"] diff --git a/sources/minigames/penguin/penguin.gd b/sources/minigames/penguin/penguin.gd index caad3fb3..79515936 100644 --- a/sources/minigames/penguin/penguin.gd +++ b/sources/minigames/penguin/penguin.gd @@ -49,3 +49,11 @@ func throw(pos: Vector2) -> void: idle() #endregion + +func idle_boss() -> void: + animated_sprite.play("idle") + animated_sprite.stop() + + +func victory_boss() -> void: + animated_sprite.play("happy") diff --git a/sources/minigames/turtles/turtle.gd b/sources/minigames/turtles/turtle.gd index 2f3c2b82..f3b186a4 100644 --- a/sources/minigames/turtles/turtle.gd +++ b/sources/minigames/turtles/turtle.gd @@ -187,3 +187,11 @@ func _on_body_area_area_entered(_area: Area2D) -> void: disappear() #endregion + +func idle_boss() -> void: + sprite.play("swim") + sprite.stop() + + +func victory_boss() -> void: + sprite.play("swim") diff --git a/sources/minigames/turtles/turtle.tscn b/sources/minigames/turtles/turtle.tscn index 27e8a87d..b32e7b40 100644 --- a/sources/minigames/turtles/turtle.tscn +++ b/sources/minigames/turtles/turtle.tscn @@ -78,7 +78,7 @@ unique_name_in_owner = true position = Vector2(0, -16) scale = Vector2(0.8, 0.8) sprite_frames = ExtResource("5_xbpgw") -animation = &"defeat" +animation = &"swim" autoplay = "swim" [node name="Sprite2D_Back" type="Sprite2D" parent="Body/AnimatedSprite2D" unique_id=1980717066] @@ -114,7 +114,6 @@ offset_left = -64.0 offset_top = -88.0 offset_right = 72.0 offset_bottom = 72.0 -text = "ch" label_settings = ExtResource("6_8k7c6") horizontal_alignment = 1 vertical_alignment = 1 diff --git a/sources/minigames/parakeets/clouds_manager.gd b/sources/utils/clouds_manager.gd similarity index 100% rename from sources/minigames/parakeets/clouds_manager.gd rename to sources/utils/clouds_manager.gd diff --git a/sources/minigames/parakeets/clouds_manager.gd.uid b/sources/utils/clouds_manager.gd.uid similarity index 100% rename from sources/minigames/parakeets/clouds_manager.gd.uid rename to sources/utils/clouds_manager.gd.uid diff --git a/sources/utils/sprite_control.gd b/sources/utils/sprite_control.gd index 96965aea..f8bd98a0 100644 --- a/sources/utils/sprite_control.gd +++ b/sources/utils/sprite_control.gd @@ -1,4 +1,3 @@ -@tool class_name SpriteControl extends Control