Add boss, first version
This commit is contained in:
@@ -13,6 +13,7 @@ enum Status{
|
||||
@export var unlocks: Dictionary[int, Dictionary] = {}:
|
||||
set(value):
|
||||
unlocks = ensure_data_integrity(value)
|
||||
@export var boss_statuses: Array[int] = []
|
||||
@export var last_modified: String
|
||||
|
||||
|
||||
@@ -24,6 +25,7 @@ func _init() -> void:
|
||||
func init_unlocks() -> void:
|
||||
if not unlocks:
|
||||
unlocks = {} # Triggers ensure_data_integrity(), that will fill the default values
|
||||
_sanitize_boss_statuses()
|
||||
|
||||
# Verify the lessons
|
||||
var number_of_lessons: int = Database.get_lessons_count()
|
||||
@@ -45,6 +47,7 @@ func init_unlocks() -> void:
|
||||
if unlocks.has(1):
|
||||
if unlocks[1]["look_and_learn"] == Status.Locked:
|
||||
unlocks[1]["look_and_learn"] = Status.Unlocked
|
||||
_sanitize_boss_statuses()
|
||||
|
||||
|
||||
func ensure_data_integrity(data: Dictionary[int, Dictionary]) -> Dictionary:
|
||||
@@ -139,12 +142,69 @@ func ensure_data_integrity(data: Dictionary[int, Dictionary]) -> Dictionary:
|
||||
if not is_init:
|
||||
Log.warn("StudentProgression: Garden %d: lesson unlocked because previous garden is completed" % index)
|
||||
|
||||
_sanitize_boss_statuses()
|
||||
return result
|
||||
|
||||
|
||||
static func get_boss_gate_lessons() -> Array[int]:
|
||||
var gates: Array[int] = []
|
||||
var total_lessons: int = Database.get_lessons_count()
|
||||
if total_lessons <= 0:
|
||||
return gates
|
||||
var boundary_lessons: Array[int] = _get_garden_boundary_lessons(total_lessons)
|
||||
var last_boss_pseudowords: int = 0
|
||||
for lesson_number: int in range(1, total_lessons + 1):
|
||||
var total_pseudowords: int = Database.get_pseudowords_for_lesson(lesson_number).size()
|
||||
var new_pseudowords: int = total_pseudowords - last_boss_pseudowords
|
||||
if new_pseudowords >= 40 and boundary_lessons.has(lesson_number):
|
||||
gates.append(lesson_number)
|
||||
last_boss_pseudowords = total_pseudowords
|
||||
return gates
|
||||
|
||||
|
||||
static func _get_garden_boundary_lessons(total_lessons: int) -> Array[int]:
|
||||
var boundaries: Array[int] = []
|
||||
var layout: GardensLayout = Gardens.get_session_layout(total_lessons)
|
||||
var distribution: Array[int] = Gardens.get_lessons_distribution(total_lessons, layout.gardens)
|
||||
var lesson_index: int = 0
|
||||
for count: int in distribution:
|
||||
if count <= 0:
|
||||
continue
|
||||
lesson_index += count
|
||||
if lesson_index < total_lessons:
|
||||
boundaries.append(lesson_index)
|
||||
return boundaries
|
||||
|
||||
|
||||
func _sanitize_boss_statuses() -> void:
|
||||
if typeof(boss_statuses) != TYPE_ARRAY:
|
||||
boss_statuses = []
|
||||
var gate_lessons: Array[int] = get_boss_gate_lessons()
|
||||
var sanitized: Array[int] = []
|
||||
for gate_lesson: int in boss_statuses:
|
||||
if gate_lessons.has(gate_lesson):
|
||||
sanitized.append(gate_lesson)
|
||||
boss_statuses = sanitized
|
||||
|
||||
|
||||
func is_boss_completed(gate_lesson: int) -> bool:
|
||||
return boss_statuses.has(gate_lesson)
|
||||
|
||||
|
||||
func is_lesson_blocked_by_boss(lesson_number: int) -> bool:
|
||||
var gate_lessons: Array[int] = get_boss_gate_lessons()
|
||||
gate_lessons.sort()
|
||||
for gate: int in gate_lessons:
|
||||
if gate < lesson_number and not boss_statuses.has(gate):
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func get_max_unlocked_lesson_index() -> int:
|
||||
var max_unlocked_level: int = 1
|
||||
for index: int in range(unlocks.size()):
|
||||
if is_lesson_blocked_by_boss(index + 1):
|
||||
break
|
||||
if unlocks[index + 1]["look_and_learn"] >= Status.Unlocked:
|
||||
max_unlocked_level = index
|
||||
else:
|
||||
@@ -184,14 +244,26 @@ func game_completed(lesson_number: int, game_number: int) -> bool:
|
||||
for index: int in range(3):
|
||||
all_completed = all_completed and unlocks[lesson_number]["games"][index] == Status.Completed
|
||||
|
||||
if all_completed and unlocks.has(lesson_number + 1):
|
||||
unlocks[lesson_number + 1]["look_and_learn"] = Status.Unlocked
|
||||
if all_completed:
|
||||
if unlocks.has(lesson_number + 1):
|
||||
unlocks[lesson_number + 1]["look_and_learn"] = Status.Unlocked
|
||||
|
||||
last_modified = Time.get_datetime_string_from_system(true)
|
||||
progression_changed.emit()
|
||||
return true
|
||||
|
||||
|
||||
func boss_completed(lesson_number: int) -> bool:
|
||||
if not get_boss_gate_lessons().has(lesson_number):
|
||||
return false
|
||||
if boss_statuses.has(lesson_number):
|
||||
return false
|
||||
boss_statuses.append(lesson_number)
|
||||
last_modified = Time.get_datetime_string_from_system(true)
|
||||
progression_changed.emit()
|
||||
return true
|
||||
|
||||
|
||||
func add_level_time(lesson_number: int, game_number: int, time_spent: int) -> void:
|
||||
Log.trace("StudentProgression: Add time to level %d, minigame %d. Time added: %s" % [lesson_number, game_number, time_spent])
|
||||
if game_number > 2:
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
class_name BossButton
|
||||
extends LessonButton
|
||||
|
||||
@export var icon_texture: Texture2D:
|
||||
set = _set_icon_texture
|
||||
|
||||
@onready var icon: TextureRect = %Icon
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super()
|
||||
if label:
|
||||
label.hide()
|
||||
_set_icon_texture(icon_texture)
|
||||
|
||||
|
||||
func _set_icon_texture(value: Texture2D) -> void:
|
||||
icon_texture = value
|
||||
if icon:
|
||||
icon.texture = value
|
||||
@@ -0,0 +1 @@
|
||||
uid://bbjhs5nta7xxj
|
||||
@@ -0,0 +1,96 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://dkxci0n2tcyxc"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://3iuuq06ovbos" path="res://assets/theme/button_normal_empty.svg" id="1_pdrhc"]
|
||||
[ext_resource type="Texture2D" uid="uid://j7sffldhbunj" path="res://assets/theme/button_pressed_empty.svg" id="2_2g676"]
|
||||
[ext_resource type="Texture2D" uid="uid://be30a3cmy0w46" path="res://assets/theme/button_focused_empty.svg" id="3_fksie"]
|
||||
[ext_resource type="Texture2D" uid="uid://c0rumwiaimvxy" path="res://assets/theme/button_disabled.svg" id="4_4vg60"]
|
||||
[ext_resource type="Script" uid="uid://c6ek75seoq4hb" path="res://sources/gardens/boss_button.gd" id="5_3d6pj"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwk8xgv3xsmm0" path="res://assets/theme/button_center.svg" id="6_o0qkw"]
|
||||
[ext_resource type="PackedScene" uid="uid://cn2rw06pltyiu" path="res://sources/utils/fx/right.tscn" id="7_rtwam"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgrjm271lrc7x" path="res://assets/minigames/fish/fish_icon.png" id="8_oy4mt"]
|
||||
|
||||
[node name="BossButton" type="TextureButton"]
|
||||
z_index = 2
|
||||
offset_right = 300.0
|
||||
offset_bottom = 300.0
|
||||
pivot_offset = Vector2(150, 150)
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
texture_normal = ExtResource("1_pdrhc")
|
||||
texture_pressed = ExtResource("2_2g676")
|
||||
texture_hover = ExtResource("3_fksie")
|
||||
texture_disabled = ExtResource("4_4vg60")
|
||||
texture_focused = ExtResource("1_pdrhc")
|
||||
stretch_mode = 0
|
||||
script = ExtResource("5_3d6pj")
|
||||
base_color = Color(0.109804, 0.14902, 0.384314, 1)
|
||||
completed_color = Color(0.109804, 0.14902, 0.384314, 1)
|
||||
icon_texture = ExtResource("8_oy4mt")
|
||||
|
||||
[node name="RightFX" parent="." instance=ExtResource("7_rtwam")]
|
||||
unique_name_in_owner = true
|
||||
show_behind_parent = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Center" type="TextureRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
show_behind_parent = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("6_o0qkw")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
unique_name_in_owner = true
|
||||
z_index = 1
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 8.0
|
||||
offset_top = 8.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 10
|
||||
theme_override_font_sizes/font_size = 110
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="Placeholder" type="TextureRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
modulate = Color(0.775063, 0.775063, 0.775063, 1)
|
||||
show_behind_parent = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("6_o0qkw")
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
texture = ExtResource("8_oy4mt")
|
||||
expand_mode = 1
|
||||
stretch_mode = 6
|
||||
+100
-8
@@ -6,6 +6,7 @@ signal minigame_layout_opened()
|
||||
const KALULU: GDScript = preload("res://sources/minigames/base/kalulu.gd")
|
||||
const GARDEN_SCENE: PackedScene = preload("res://resources/gardens/garden.tscn")
|
||||
const LOOK_AND_LEARN_SCENE: PackedScene = preload("res://sources/look_and_learn/look_and_learn.tscn")
|
||||
const BOSS_BUTTON_SCENE: PackedScene = preload("res://sources/gardens/boss_button.tscn")
|
||||
const FLOWER_VFX: PackedScene = preload("res://sources/gardens/flower_particle.tscn")
|
||||
const GARDEN_SIZE: int = 2400
|
||||
const GARDEN_TEXTURES_NB: int = 20
|
||||
@@ -37,6 +38,7 @@ static var cached_layout_lessons: int = 0
|
||||
|
||||
var lessons: Dictionary = {}
|
||||
var points: Array[Array] = []
|
||||
var lesson_distribution: Array[int] = []
|
||||
var is_scrolling: bool = false
|
||||
var scroll_beginning_garden: int = 0
|
||||
var scroll_tween: Tween
|
||||
@@ -55,6 +57,7 @@ var lesson_to_flower_index: Dictionary = {}
|
||||
@onready var line_audio_stream_player: AudioStreamPlayer2D = %LineAudioStreamPlayer
|
||||
@onready var scroll_container: ScrollContainer = $ScrollContainer
|
||||
@onready var parallax_background: ParallaxBackground = %ParallaxBackground
|
||||
@onready var boss_buttons_container: Control = %BossButtons
|
||||
@onready var minigame_selection: Control = %MinigameSelection
|
||||
@onready var lesson_button: LessonButton = %LessonButton
|
||||
@onready var lesson_button_particles: GPUParticles2D = %LessonButtonParticles
|
||||
@@ -130,8 +133,9 @@ func _apply_progression_to_gardens(transition_context: Dictionary) -> void:
|
||||
|
||||
lesson_to_flower_index[lesson_index] = {"garden": garden_control, "index": button_index}
|
||||
var lesson_unlocks: Dictionary = UserDataManager.student_progression.unlocks[lesson_index]
|
||||
var is_lesson_unlocked: bool = lesson_unlocks["look_and_learn"] != StudentProgression.Status.Locked
|
||||
var is_look_and_learn_completed: bool = lesson_unlocks["look_and_learn"] == StudentProgression.Status.Completed
|
||||
var is_blocked_by_boss: bool = UserDataManager.student_progression.is_lesson_blocked_by_boss(lesson_index)
|
||||
var is_lesson_unlocked: bool = lesson_unlocks["look_and_learn"] != StudentProgression.Status.Locked and not is_blocked_by_boss
|
||||
var is_look_and_learn_completed: bool = lesson_unlocks["look_and_learn"] == StudentProgression.Status.Completed and not is_blocked_by_boss
|
||||
button.set_disabled(not is_lesson_unlocked)
|
||||
if button_index < garden_control.flowers_visible.size():
|
||||
garden_control.flowers_visible[button_index] = is_look_and_learn_completed
|
||||
@@ -140,9 +144,9 @@ func _apply_progression_to_gardens(transition_context: Dictionary) -> void:
|
||||
button.set_disabled(true)
|
||||
|
||||
if not(transition_context.new_lesson_unlocked and lesson_index == transition_context.newly_unlocked_lesson_number - 1):
|
||||
button.completed = UserDataManager.student_progression.is_lesson_completed(lesson_index)
|
||||
button.completed = UserDataManager.student_progression.is_lesson_completed(lesson_index) and not is_blocked_by_boss
|
||||
|
||||
var completed_minigames: int = _count_completed_minigames(lesson_index)
|
||||
var completed_minigames: int = 0 if is_blocked_by_boss else _count_completed_minigames(lesson_index)
|
||||
if transition_context.is_current_lesson and transition_context.is_first_clear and transition_context.is_minigame_completed and transition_context.last_played_minigame_number >= 0 and transition_context.last_played_minigame_number < (lesson_unlocks["games"] as Array).size():
|
||||
if lesson_unlocks["games"][transition_context.last_played_minigame_number] == StudentProgression.Status.Completed:
|
||||
completed_minigames = max(0, completed_minigames - 1)
|
||||
@@ -153,6 +157,7 @@ func _apply_progression_to_gardens(transition_context: Dictionary) -> void:
|
||||
lesson_index += 1
|
||||
|
||||
garden_control.update_flowers()
|
||||
_set_up_boss_buttons()
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -179,11 +184,12 @@ func _scroll_to_starting_garden(_transition_context: Dictionary) -> void:
|
||||
|
||||
if UserDataManager.student_progression:
|
||||
var unlock: Dictionary = UserDataManager.student_progression.unlocks[lesson_index]
|
||||
var is_blocked_by_boss: bool = UserDataManager.student_progression.is_lesson_blocked_by_boss(lesson_index)
|
||||
var look_and_learn_unlocked: bool = unlock["look_and_learn"] == StudentProgression.Status.Unlocked
|
||||
var exercise_unlock_1: bool = unlock["games"][0] == StudentProgression.Status.Unlocked
|
||||
var exercise_unlock_2: bool = unlock["games"][1] == StudentProgression.Status.Unlocked
|
||||
var exercise_unlock_3: bool = unlock["games"][2] == StudentProgression.Status.Unlocked
|
||||
if look_and_learn_unlocked or exercise_unlock_1 or exercise_unlock_2 or exercise_unlock_3:
|
||||
if not is_blocked_by_boss and (look_and_learn_unlocked or exercise_unlock_1 or exercise_unlock_2 or exercise_unlock_3):
|
||||
starting_garden = garden_index
|
||||
break
|
||||
|
||||
@@ -204,7 +210,7 @@ func _handle_transition_sequences(transition_context: Dictionary) -> void:
|
||||
# Wait a bit before any action to smooth the animations
|
||||
await get_tree().create_timer(1).timeout
|
||||
|
||||
if transition_data.has("current_lesson_number"):
|
||||
if transition_data.has("current_lesson_number") and not transition_data.get("skip_minigame_layout", false):
|
||||
await _open_minigames_layout(_get_current_lesson_button(transition_data.current_lesson_number as int), transition_data.current_lesson_number as int)
|
||||
|
||||
if transition_context.new_lesson_unlocked:
|
||||
@@ -851,6 +857,7 @@ func set_gardens_layout(p_gardens_layout: GardensLayout) -> void:
|
||||
Log.trace("Gardens: Yielding a frame to ensure garden controls are ready before setting up the path")
|
||||
await get_tree().process_frame
|
||||
set_up_path()
|
||||
_set_up_boss_buttons()
|
||||
|
||||
|
||||
func add_gardens() -> void:
|
||||
@@ -860,7 +867,7 @@ func add_gardens() -> void:
|
||||
for child: Node in garden_parent.get_children():
|
||||
child.free()
|
||||
Log.info("Gardens: Computing lesson distribution for new gardens")
|
||||
var distribution: Array[int] = get_lessons_distribution(lessons.size(), gardens_layout.gardens)
|
||||
lesson_distribution = get_lessons_distribution(lessons.size(), gardens_layout.gardens)
|
||||
var garden_index: int = 0
|
||||
for layout_index: int in range(gardens_layout.gardens.size()):
|
||||
Log.trace("Gardens: Preparing garden %s with layout index %s" % [str(garden_index), str(layout_index)])
|
||||
@@ -869,11 +876,12 @@ func add_gardens() -> void:
|
||||
garden_parent.add_child(garden)
|
||||
garden.garden_index = garden_index
|
||||
garden_index += 1
|
||||
var lessons_for_garden: int = distribution[layout_index]
|
||||
var lessons_for_garden: int = lesson_distribution[layout_index]
|
||||
Log.trace("Gardens: Garden %s will host %s lessons" % [str(garden.garden_index), str(lessons_for_garden)])
|
||||
garden_layout.lesson_buttons.resize(lessons_for_garden)
|
||||
Log.trace("Gardens: Assigning layout to garden %s" % str(garden.garden_index))
|
||||
garden.garden_layout = garden_layout
|
||||
_sync_boss_buttons_container()
|
||||
|
||||
|
||||
func set_up_path() -> void:
|
||||
@@ -913,6 +921,74 @@ func _set_unlocked_path(max_unlocked_lesson_index: int) -> void:
|
||||
#endregion
|
||||
|
||||
|
||||
func _sync_boss_buttons_container() -> void:
|
||||
if not boss_buttons_container or not garden_parent:
|
||||
return
|
||||
boss_buttons_container.position = Vector2.ZERO
|
||||
boss_buttons_container.size = scroll_container.size
|
||||
|
||||
|
||||
func _clear_boss_buttons() -> void:
|
||||
if not boss_buttons_container:
|
||||
return
|
||||
for child: Node in boss_buttons_container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
|
||||
func _set_up_boss_buttons() -> void:
|
||||
_clear_boss_buttons()
|
||||
if not boss_buttons_container:
|
||||
return
|
||||
_sync_boss_buttons_container()
|
||||
if lesson_distribution.is_empty() or points.is_empty():
|
||||
return
|
||||
var total_lessons: int = lessons.size()
|
||||
if total_lessons <= 0:
|
||||
return
|
||||
var gate_lessons: Array[int] = StudentProgression.get_boss_gate_lessons()
|
||||
for gate_lesson: int in gate_lessons:
|
||||
if gate_lesson <= 0 or gate_lesson >= total_lessons:
|
||||
continue
|
||||
if gate_lesson - 1 >= points.size() or gate_lesson >= points.size():
|
||||
continue
|
||||
var boss_position: Vector2 = _get_boss_button_position(gate_lesson)
|
||||
if boss_position == Vector2.ZERO:
|
||||
continue
|
||||
var boss_button: BossButton = BOSS_BUTTON_SCENE.instantiate()
|
||||
boss_buttons_container.add_child(boss_button)
|
||||
var boss_size: Vector2 = boss_button.get_combined_minimum_size()
|
||||
if boss_size == Vector2.ZERO:
|
||||
boss_size = boss_button.size
|
||||
boss_button.position = boss_position - boss_size * 0.5
|
||||
if UserDataManager.student_progression:
|
||||
var is_completed: bool = UserDataManager.student_progression.is_boss_completed(gate_lesson)
|
||||
var is_blocked_by_boss: bool = UserDataManager.student_progression.is_lesson_blocked_by_boss(gate_lesson)
|
||||
var is_unlocked: bool = UserDataManager.student_progression.is_lesson_completed(gate_lesson) and not is_blocked_by_boss
|
||||
boss_button.set_disabled(not is_unlocked and not is_completed)
|
||||
boss_button.completed = is_completed
|
||||
else:
|
||||
boss_button.set_disabled(true)
|
||||
var garden_index: int = _get_garden_index_for_lesson(gate_lesson)
|
||||
boss_button.pressed.connect(_on_boss_button_pressed.bind(gate_lesson, garden_index))
|
||||
|
||||
|
||||
func _get_boss_button_position(gate_lesson: int) -> Vector2:
|
||||
if gate_lesson <= 0 or gate_lesson >= points.size():
|
||||
return Vector2.ZERO
|
||||
var start_point: Vector2 = points[gate_lesson - 1][0] as Vector2
|
||||
var end_point: Vector2 = points[gate_lesson][0] as Vector2
|
||||
return start_point.lerp(end_point, 0.5)
|
||||
|
||||
|
||||
func _get_garden_index_for_lesson(lesson_number: int) -> int:
|
||||
var lesson_index: int = 0
|
||||
for garden_index: int in range(lesson_distribution.size()):
|
||||
lesson_index += lesson_distribution[garden_index]
|
||||
if lesson_number <= lesson_index:
|
||||
return garden_index
|
||||
return max(0, lesson_distribution.size() - 1)
|
||||
|
||||
|
||||
func _lock() -> void:
|
||||
is_locked = true
|
||||
lock.show()
|
||||
@@ -951,6 +1027,22 @@ func _on_lesson_button_pressed() -> void:
|
||||
get_tree().change_scene_to_packed(LOOK_AND_LEARN_SCENE)
|
||||
|
||||
|
||||
func _on_boss_button_pressed(lesson_number: int, garden_index: int) -> void:
|
||||
if is_locked:
|
||||
return
|
||||
feedback_audio_stream_player.play()
|
||||
await OpeningCurtain.close()
|
||||
Minigame.transition_data = {
|
||||
current_lesson_number = lesson_number,
|
||||
current_garden_index = garden_index,
|
||||
minigame_number = -1,
|
||||
minigame_completed = false,
|
||||
skip_minigame_layout = true,
|
||||
boss_gate_lesson = lesson_number
|
||||
}
|
||||
get_tree().change_scene_to_file("res://sources/minigames/fish/fish_minigame.tscn")
|
||||
|
||||
|
||||
func _on_minigame_button_pressed(minigame_scene: PackedScene, minigame_number: int) -> void:
|
||||
if is_locked:
|
||||
return
|
||||
|
||||
@@ -232,6 +232,10 @@ size_flags_horizontal = 3
|
||||
custom_minimum_size = Vector2(80, 2.08165e-12)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="BossButtons" type="Control" parent="ScrollContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
|
||||
[node name="LockedLine" type="Line2D" parent="ScrollContainer"]
|
||||
unique_name_in_owner = true
|
||||
width = 20.0
|
||||
|
||||
@@ -205,7 +205,11 @@ func _win() -> void:
|
||||
gardens_data.minigame_completed = true
|
||||
|
||||
if UserDataManager.student_progression:
|
||||
gardens_data.first_clear = UserDataManager.student_progression.game_completed(lesson_nb, minigame_number)
|
||||
if gardens_data.has("boss_gate_lesson"):
|
||||
gardens_data.boss_completed = UserDataManager.student_progression.boss_completed(gardens_data.boss_gate_lesson as int)
|
||||
gardens_data.first_clear = gardens_data.boss_completed
|
||||
else:
|
||||
gardens_data.first_clear = UserDataManager.student_progression.game_completed(lesson_nb, minigame_number)
|
||||
|
||||
update_scores()
|
||||
|
||||
@@ -270,6 +274,8 @@ func _lose() -> void:
|
||||
|
||||
|
||||
func _submit_student_level_time() -> void:
|
||||
if gardens_data.has("boss_gate_lesson"):
|
||||
return
|
||||
UserDataManager.add_level_time(lesson_nb, minigame_number, _get_elapsed_time_seconds())
|
||||
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ const FISH_TEXTURE_RECT_SCENE: PackedScene = preload("res://sources/minigames/fi
|
||||
@export var game_duration: int = 4 * 60
|
||||
@export var minimum_correct_ratio: float = 0.8
|
||||
@export var winning_color: Color = Color.WHITE
|
||||
@export var max_words_count: int = 15
|
||||
@export var max_words_count: int = 1
|
||||
|
||||
var tween: Tween
|
||||
var words_to_present: Array[String] = []
|
||||
var words_to_present_next: Array[String] = []
|
||||
var progress_gauge_max_margin: float = 0.95
|
||||
var total_number_of_words: int = 30
|
||||
var total_number_of_words: int = 2
|
||||
var tutorial_count: int = 0
|
||||
|
||||
@onready var fish_start_zone: Control = %FishStartZone
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://dxqnvbr4tffn7" path="res://assets/minigames/minigame_ui/graphic/gauge.png" id="11_p5wnc"]
|
||||
[ext_resource type="PackedScene" uid="uid://dlmbxcgiv8tpr" path="res://sources/utils/fx/wrong.tscn" id="11_ueo10"]
|
||||
[ext_resource type="Texture2D" uid="uid://4ci6gmg0c15o" path="res://assets/minigames/minigame_ui/graphic/white_gauge.png" id="12_w5m1b"]
|
||||
[ext_resource type="Texture2D" uid="uid://disgg14rdmp81" path="res://assets/minigames/monkeys/graphic/textplank.png" id="13_3p0ue"]
|
||||
[ext_resource type="Texture2D" uid="uid://disgg14rdmp81" path="res://assets/minigames/fish/textplank.png" id="13_3p0ue"]
|
||||
[ext_resource type="Script" uid="uid://d5qkkg88431w" path="res://sources/utils/percent_margin_container.gd" id="14_b3ilp"]
|
||||
[ext_resource type="LabelSettings" uid="uid://bguqnhiblwick" path="res://resources/themes/minigames_label_settings.tres" id="17_47luc"]
|
||||
|
||||
@@ -485,7 +485,7 @@ script = ExtResource("2_68jip")
|
||||
game_duration = 240
|
||||
minimum_correct_ratio = 0.8
|
||||
winning_color = Color(2.988, 2.328, 0.6, 1)
|
||||
max_words_count = 15
|
||||
max_words_count = 1
|
||||
minigame_name = 9
|
||||
lesson_nb = 50
|
||||
|
||||
@@ -536,7 +536,6 @@ texture = ExtResource("5_dc51h")
|
||||
|
||||
[node name="Beacon1" type="Control" parent="GameRoot" index="4" node_paths=PackedStringArray("sprites")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = 408.0
|
||||
offset_top = 200.0
|
||||
@@ -546,7 +545,7 @@ script = ExtResource("4_8mkk3")
|
||||
sprites = [NodePath("Beacon")]
|
||||
|
||||
[node name="Beacon" type="AnimatedSprite2D" parent="GameRoot/Beacon1" index="0"]
|
||||
scale = Vector2(1.79651, 1.74845)
|
||||
scale = Vector2(1.7965117, 1.7484472)
|
||||
sprite_frames = SubResource("SpriteFrames_25r11")
|
||||
animation = &"idle"
|
||||
autoplay = "idle"
|
||||
@@ -555,6 +554,7 @@ centered = false
|
||||
|
||||
[node name="FalseWrongFX" parent="GameRoot/Beacon1" index="1" instance=ExtResource("11_ueo10")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = 306.0
|
||||
offset_top = 533.0
|
||||
offset_right = 306.0
|
||||
@@ -562,6 +562,7 @@ offset_bottom = 533.0
|
||||
|
||||
[node name="FalseRightFX" parent="GameRoot/Beacon1" index="2" instance=ExtResource("9_mcq4c")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = 306.0
|
||||
offset_top = 521.0
|
||||
offset_right = 306.0
|
||||
@@ -569,7 +570,6 @@ offset_bottom = 521.0
|
||||
|
||||
[node name="Beacon2" type="Control" parent="GameRoot" index="5" node_paths=PackedStringArray("sprites")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = 1600.0
|
||||
offset_top = 200.0
|
||||
@@ -579,7 +579,7 @@ script = ExtResource("4_8mkk3")
|
||||
sprites = [NodePath("Beacon")]
|
||||
|
||||
[node name="Beacon" type="AnimatedSprite2D" parent="GameRoot/Beacon2" index="0"]
|
||||
scale = Vector2(1.79651, 1.74845)
|
||||
scale = Vector2(1.7965117, 1.7484472)
|
||||
sprite_frames = SubResource("SpriteFrames_ru7b5")
|
||||
animation = &"idle"
|
||||
centered = false
|
||||
@@ -604,6 +604,7 @@ speed_scale = 0.5
|
||||
|
||||
[node name="RealWrongFX" parent="GameRoot/Beacon2" index="3" instance=ExtResource("11_ueo10")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = 306.0
|
||||
offset_top = 533.0
|
||||
offset_right = 306.0
|
||||
@@ -611,6 +612,7 @@ offset_bottom = 533.0
|
||||
|
||||
[node name="RealRightFX" parent="GameRoot/Beacon2" index="4" instance=ExtResource("9_mcq4c")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = 306.0
|
||||
offset_top = 521.0
|
||||
offset_right = 306.0
|
||||
@@ -634,7 +636,7 @@ sprites = [NodePath("FishAnimatedSprite")]
|
||||
|
||||
[node name="FishAnimatedSprite" type="AnimatedSprite2D" parent="GameRoot/AspectRatioContainer/Fish" index="0"]
|
||||
unique_name_in_owner = true
|
||||
scale = Vector2(2.20411, 2.2041)
|
||||
scale = Vector2(2.2041097, 2.2040977)
|
||||
sprite_frames = SubResource("SpriteFrames_ukbiw")
|
||||
animation = &"idle"
|
||||
autoplay = "idle"
|
||||
|
||||
Reference in New Issue
Block a user