Merge pull request #322 from Excello-Recherche-Education/prevent-crash
Prevent boss minigame crash
This commit is contained in:
@@ -4,6 +4,14 @@ const FINAL_BOSS_GAME_DURATION: int = 20 * 60
|
||||
const FINAL_BOSS_TOTAL_WORDS: int = 180
|
||||
const GAUGE_COLOR_LOW: Color = Color(0.55, 0.95, 0.45)
|
||||
const GAUGE_COLOR_HIGH: Color = Color(0.996078, 0.776471, 0.2)
|
||||
const MONKEY_SCENE_PATH: String = "res://sources/minigames/monkeys/monkey.tscn"
|
||||
const TURTLE_SCENE_PATH: String = "res://sources/minigames/turtles/turtle.tscn"
|
||||
const PENGUIN_SCENE_PATH: String = "res://sources/minigames/penguin/penguin.tscn"
|
||||
const FROG_SCENE_PATH: String = "res://sources/minigames/frog/frog.tscn"
|
||||
const CRAB_SCENE_PATH: String = "res://sources/minigames/crabs/crab/crab.tscn"
|
||||
const PARAKEET_SCENE_PATH: String = "res://sources/minigames/parakeets/parakeet.tscn"
|
||||
const ANT_SCENE_PATH: String = "res://sources/minigames/ants/ant.tscn"
|
||||
const JELLYFISH_SCENE_PATH: String = "res://sources/minigames/jellyfish/jellyfish.tscn"
|
||||
|
||||
@export var game_duration: int = 4 * 60
|
||||
@export var minimum_correct_ratio: float = 0.8
|
||||
@@ -23,6 +31,14 @@ var default_label_background_color: Color
|
||||
var _correct_answer_tween: Tween
|
||||
var _victory_pulse_tween: Tween
|
||||
var _victory_threshold_reached: bool = false
|
||||
var turtle: Turtle
|
||||
var frog: Frog
|
||||
var crab: Crab
|
||||
var penguin: Penguin
|
||||
var monkey: Monkey
|
||||
var parakeet: Parakeet
|
||||
var ant: Ant
|
||||
var jellyfish: Jellyfish
|
||||
|
||||
@onready var text_start_zone: Control = %ControlText
|
||||
@onready var texture_button_bin: TextureButton = $GameRoot/TextureButtonBin
|
||||
@@ -38,21 +54,14 @@ var _victory_threshold_reached: bool = false
|
||||
@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
|
||||
@onready var friends_container: Node2D = $GameRoot/Friends
|
||||
@onready var friends_behind_frame_container: Node2D = $GameRoot/Friends_Behind_Frame
|
||||
|
||||
|
||||
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)
|
||||
@@ -72,6 +81,95 @@ func _ready() -> void:
|
||||
if UserDataManager.is_speech_played(TYPE_NAMES[minigame_name]):
|
||||
tutorial_count = 2
|
||||
|
||||
_instantiate_animal_friends()
|
||||
|
||||
|
||||
func _instantiate_animal_friends() -> void:
|
||||
await get_tree().process_frame
|
||||
if not is_inside_tree():
|
||||
return
|
||||
|
||||
monkey = (load(MONKEY_SCENE_PATH) as PackedScene).instantiate()
|
||||
monkey.position = Vector2(125, 62)
|
||||
monkey.scale = Vector2(0.7, 0.7)
|
||||
friends_container.add_child(monkey)
|
||||
|
||||
await get_tree().process_frame
|
||||
if not is_inside_tree():
|
||||
return
|
||||
|
||||
turtle = (load(TURTLE_SCENE_PATH) as PackedScene).instantiate()
|
||||
turtle.position = Vector2(-220, 120)
|
||||
turtle.rotation = 1.5707964
|
||||
turtle.scale = Vector2(0.18, 0.18)
|
||||
friends_container.add_child(turtle)
|
||||
|
||||
await get_tree().process_frame
|
||||
if not is_inside_tree():
|
||||
return
|
||||
|
||||
penguin = (load(PENGUIN_SCENE_PATH) as PackedScene).instantiate()
|
||||
penguin.position = Vector2(28, 114)
|
||||
penguin.scale = Vector2(0.3, 0.3)
|
||||
friends_container.add_child(penguin)
|
||||
|
||||
await get_tree().process_frame
|
||||
if not is_inside_tree():
|
||||
return
|
||||
|
||||
frog = (load(FROG_SCENE_PATH) as PackedScene).instantiate()
|
||||
frog.offset_left = -43.999985
|
||||
frog.offset_top = 112.0
|
||||
frog.offset_right = -43.999985
|
||||
frog.offset_bottom = 112.0
|
||||
frog.scale = Vector2(0.4, 0.4)
|
||||
friends_container.add_child(frog)
|
||||
|
||||
await get_tree().process_frame
|
||||
if not is_inside_tree():
|
||||
return
|
||||
|
||||
crab = (load(CRAB_SCENE_PATH) as PackedScene).instantiate()
|
||||
crab.offset_left = -220.0
|
||||
crab.offset_top = 32.0
|
||||
crab.offset_right = 148.0
|
||||
crab.offset_bottom = 352.0
|
||||
crab.scale = Vector2(0.45, 0.45)
|
||||
friends_container.add_child(crab)
|
||||
|
||||
await get_tree().process_frame
|
||||
if not is_inside_tree():
|
||||
return
|
||||
|
||||
parakeet = (load(PARAKEET_SCENE_PATH) as PackedScene).instantiate()
|
||||
parakeet.position = Vector2(124, -103)
|
||||
parakeet.scale = Vector2(0.09, 0.09)
|
||||
friends_container.add_child(parakeet)
|
||||
|
||||
await get_tree().process_frame
|
||||
if not is_inside_tree():
|
||||
return
|
||||
|
||||
ant = (load(ANT_SCENE_PATH) as PackedScene).instantiate()
|
||||
ant.position = Vector2(228, 132)
|
||||
ant.scale = Vector2(0.17, 0.17)
|
||||
friends_container.add_child(ant)
|
||||
|
||||
await get_tree().process_frame
|
||||
if not is_inside_tree():
|
||||
return
|
||||
|
||||
jellyfish = (load(JELLYFISH_SCENE_PATH) as PackedScene).instantiate()
|
||||
jellyfish.offset_left = 1449.0001
|
||||
jellyfish.offset_top = 1301.0001
|
||||
jellyfish.offset_right = 1849.0001
|
||||
jellyfish.offset_bottom = 1701.0001
|
||||
jellyfish.scale = Vector2(0.45, 0.45)
|
||||
jellyfish.boss = true
|
||||
friends_behind_frame_container.add_child(jellyfish)
|
||||
|
||||
setup_animal_friends()
|
||||
|
||||
|
||||
func setup_animal_friends() -> void:
|
||||
turtle.idle_boss()
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
[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"]
|
||||
@@ -22,15 +21,8 @@
|
||||
[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="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 = {
|
||||
@@ -92,14 +84,6 @@ 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)
|
||||
@@ -251,41 +235,6 @@ texture = ExtResource("12_2c6ay")
|
||||
self_modulate = Color(1, 1, 1, 0.34509805)
|
||||
position = Vector2(1676, 1280)
|
||||
|
||||
[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, 114)
|
||||
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, 132)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user