Debug special effect position

This commit is contained in:
Adrien Ufferte
2025-12-12 15:05:13 +01:00
parent 5b24456c73
commit f859affddc
+22 -1
View File
@@ -120,7 +120,13 @@ func _ready() -> void:
if new_lesson_unlocked:
newly_unlocked_lesson_number = max_unlocked_lesson_number + 1
#region Progression
# Sets the unlocked line and particles to the most advanced unlocked lesson before playing any animation
var most_advanced_unlocked_lesson_index: int = max_unlocked_lesson_index
if new_lesson_unlocked:
most_advanced_unlocked_lesson_index -= 1
_set_unlocked_path(most_advanced_unlocked_lesson_index)
#region Progression
# Loads the progression of the player without the newly unlocked stuff from the transition data
var lesson_ind: int = 1
@@ -680,6 +686,21 @@ func set_up_path() -> void:
locked_line.points = curve.get_baked_points()
func _set_unlocked_path(max_unlocked_lesson_index: int) -> void:
unlocked_line.clear_points()
if max_unlocked_lesson_index < 0 or points.is_empty():
return
var clamped_lesson_index: int = clamp(max_unlocked_lesson_index, 0, points.size() - 1)
var progress_curve: Curve2D = Curve2D.new()
for index: int in range(clamped_lesson_index + 1):
var point_data: Array = points[index]
progress_curve.add_point(point_data[0] as Vector2, point_data[1] as Vector2, point_data[2] as Vector2)
var baked_points: PackedVector2Array = progress_curve.get_baked_points()
unlocked_line.points = baked_points
if baked_points.size() > 0:
line_particles.position = baked_points[baked_points.size() - 1]
func _lock() -> void:
is_locked = true
lock.show()