Adds lookandlearn, minigames and lesson completion animations to the gardens. Adds sounds in the brain screen and the gardens.
|
Before Width: | Height: | Size: 216 KiB After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 216 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dbwfhtp3vyula"
|
||||
path="res://.godot/imported/bottom_old.png-c7d78719e8343221c4d80fb23c8d913b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/lesson_screen/bottom_old.png"
|
||||
dest_files=["res://.godot/imported/bottom_old.png-c7d78719e8343221c4d80fb23c8d913b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
Before Width: | Height: | Size: 247 KiB After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 247 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c6uonttx82lxu"
|
||||
path="res://.godot/imported/top_left_old.png-a96dd95b24772d90b129c5ea42c030e8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/lesson_screen/top_left_old.png"
|
||||
dest_files=["res://.godot/imported/top_left_old.png-a96dd95b24772d90b129c5ea42c030e8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
Before Width: | Height: | Size: 246 KiB After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 246 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dk51t50ahw8bl"
|
||||
path="res://.godot/imported/top_right_old.png-9c9acd8e343d495a6a33cea37e8d5f10.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/lesson_screen/top_right_old.png"
|
||||
dest_files=["res://.godot/imported/top_right_old.png-9c9acd8e343d495a6a33cea37e8d5f10.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -1,19 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://b8pn5vqgp6jlt"
|
||||
path="res://.godot/imported/ui_title_card_music.mp3-325c21e21b4e9af1266c440ecda44dda.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/menus/main/ui_title_card_music.mp3"
|
||||
dest_files=["res://.godot/imported/ui_title_card_music.mp3-325c21e21b4e9af1266c440ecda44dda.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://6vghn6lg6egp"
|
||||
path="res://.godot/imported/garden.mp3-dde7dbc18c0360291b1da4e4cd642b21.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/music/garden.mp3"
|
||||
dest_files=["res://.godot/imported/garden.mp3-dde7dbc18c0360291b1da4e4cd642b21.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://b8pn5vqgp6jlt"
|
||||
path="res://.godot/imported/title.mp3-a77078abb1068f5ad2ee22df2780d1cc.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/music/title.mp3"
|
||||
dest_files=["res://.godot/imported/title.mp3-a77078abb1068f5ad2ee22df2780d1cc.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://vyj4leik80w2"
|
||||
path="res://.godot/imported/swoosh.mp3-c4262c456d592fc916691377efafe121.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sfx/swoosh.mp3"
|
||||
dest_files=["res://.godot/imported/swoosh.mp3-c4262c456d592fc916691377efafe121.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://bwjerrgyy6dnj"
|
||||
path="res://.godot/imported/ui_garden_button.mp3-019e0961af169c5498ef802fe5d12db9.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sfx/ui_garden_button.mp3"
|
||||
dest_files=["res://.godot/imported/ui_garden_button.mp3-019e0961af169c5498ef802fe5d12db9.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://dbk6f1ufxkdwd"
|
||||
path="res://.godot/imported/ui_no_button.mp3-dd11a815506e02ed4f981f32d9e3fd46.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sfx/ui_no_button.mp3"
|
||||
dest_files=["res://.godot/imported/ui_no_button.mp3-dd11a815506e02ed4f981f32d9e3fd46.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://bgqlyvqoo46qw"
|
||||
path="res://.godot/imported/ui_pause_button.mp3-e7d1b496a9e5d52c3190ffbdb1abd90c.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sfx/ui_pause_button.mp3"
|
||||
dest_files=["res://.godot/imported/ui_pause_button.mp3-e7d1b496a9e5d52c3190ffbdb1abd90c.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://dhbcuswlxjrwc"
|
||||
path="res://.godot/imported/ui_play_button.mp3-91d2adbfcf3dceab31bd60610c96158f.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sfx/ui_play_button.mp3"
|
||||
dest_files=["res://.godot/imported/ui_play_button.mp3-91d2adbfcf3dceab31bd60610c96158f.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://bgof22p2ofunc"
|
||||
path="res://.godot/imported/ui_yes_button.mp3-cd9b16aeec0052c8bcd4dcded363b287.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sfx/ui_yes_button.mp3"
|
||||
dest_files=["res://.godot/imported/ui_yes_button.mp3-cd9b16aeec0052c8bcd4dcded363b287.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -63,7 +63,7 @@ flowers_export = Array[Dictionary]([{
|
||||
"type": 3
|
||||
}, {
|
||||
"color": 1,
|
||||
"position": Vector2i(264, 548),
|
||||
"position": Vector2i(392, 628),
|
||||
"type": 4
|
||||
}])
|
||||
lesson_buttons_export = Array[Dictionary]([{
|
||||
|
||||
@@ -27,18 +27,25 @@ const garden_size: = 2400
|
||||
@onready var garden_parent: = %GardenParent
|
||||
@onready var locked_line: Line2D = $ScrollContainer/LockedLine
|
||||
@onready var unlocked_line: Line2D = $ScrollContainer/UnlockedLine
|
||||
@onready var line_particles: GPUParticles2D = %LineParticles
|
||||
@onready var line_audio_stream_player: AudioStreamPlayer = %LineAudioStreamPlayer
|
||||
@onready var scroll_container: ScrollContainer = $ScrollContainer
|
||||
@onready var parallax_background: = %ParallaxBackground
|
||||
@onready var minigame_selection: Control = %MinigameSelection
|
||||
@onready var lesson_button: LessonButton = %LessonButton
|
||||
@onready var lesson_button_particles: GPUParticles2D = %LessonButtonParticles
|
||||
@onready var back_button: TextureButton = %BackButton
|
||||
@onready var right_audio_stream_player: AudioStreamPlayer = $RightAudioStreamPlayer
|
||||
@onready var left_audio_stream_player: AudioStreamPlayer = $LeftAudioStreamPlayer
|
||||
@onready var feedback_audio_stream_player: AudioStreamPlayer = $FeedBackAudioStreamPlayer
|
||||
@onready var feedback_audio_stream_player2: AudioStreamPlayer = $FeedBackAudioStreamPlayer2
|
||||
@onready var minigame_layout_1: MinigameLayout = %MinigameBackground1
|
||||
@onready var minigame_layout_2: MinigameLayout = %MinigameBackground2
|
||||
@onready var minigame_layout_3: MinigameLayout = %MinigameBackground3
|
||||
@onready var minigame_background: TextureRect = %MinigameBackground
|
||||
@onready var minigame_background_center: TextureRect = %MinigameBackgroundCenter
|
||||
@onready var lock: Control = %Lock
|
||||
|
||||
|
||||
var lessons: = {}
|
||||
var points: = []
|
||||
@@ -52,6 +59,8 @@ var current_garden: = -1
|
||||
var current_button_global_position: = Vector2.ZERO
|
||||
var current_button: LessonButton
|
||||
|
||||
var new_lesson_unlocked: bool = false
|
||||
|
||||
static var transition_data: Dictionary
|
||||
|
||||
|
||||
@@ -66,54 +75,138 @@ func _ready() -> void:
|
||||
await get_tree().process_frame
|
||||
|
||||
if UserDataManager.student_progression:
|
||||
UserDataManager.student_progression.unlocks_changed.connect(_on_progression_unlocks_changed)
|
||||
_on_progression_unlocks_changed()
|
||||
|
||||
# Defines if a new lesson has been unlocked by the player, setups to play the right animation
|
||||
new_lesson_unlocked = transition_data and transition_data.current_lesson_number == UserDataManager.student_progression.get_max_unlocked_lesson() and transition_data.minigame_number == 2 and transition_data.minigame_completed
|
||||
|
||||
if starting_garden == -1:
|
||||
var lesson_ind: = 1
|
||||
for garden_ind in garden_parent.get_child_count():
|
||||
var garden_control: = garden_parent.get_child(garden_ind)
|
||||
if starting_garden != -1:
|
||||
break
|
||||
if not lesson_ind in lessons:
|
||||
break
|
||||
for i in garden_control.lesson_button_controls.size():
|
||||
if new_lesson_unlocked:
|
||||
_lock()
|
||||
|
||||
# Loads the progression of the player
|
||||
_set_progression()
|
||||
|
||||
# Scrolls to the right garden
|
||||
if not transition_data:
|
||||
if starting_garden == -1:
|
||||
var lesson_ind: = 1
|
||||
for garden_ind in garden_parent.get_child_count():
|
||||
var garden_control: = garden_parent.get_child(garden_ind)
|
||||
if starting_garden != -1:
|
||||
break
|
||||
if not lesson_ind in lessons:
|
||||
break
|
||||
|
||||
if UserDataManager.student_progression:
|
||||
var unlock: Dictionary = UserDataManager.student_progression.unlocks[lesson_ind]
|
||||
var look_and_learn_unlocked: bool = unlock["look_and_learn"] == UserProgression.Status.Unlocked
|
||||
var exercice_unlock_1: bool = unlock["games"][0] == UserProgression.Status.Unlocked
|
||||
var exercice_unlock_2: bool = unlock["games"][1] == UserProgression.Status.Unlocked
|
||||
var exercice_unlock_3: bool = unlock["games"][2] == UserProgression.Status.Unlocked
|
||||
if look_and_learn_unlocked or exercice_unlock_1 or exercice_unlock_2 or exercice_unlock_3:
|
||||
starting_garden = garden_ind
|
||||
for i in garden_control.lesson_button_controls.size():
|
||||
if not lesson_ind in lessons:
|
||||
break
|
||||
lesson_ind += 1
|
||||
|
||||
if UserDataManager.student_progression:
|
||||
var unlock: Dictionary = UserDataManager.student_progression.unlocks[lesson_ind]
|
||||
|
||||
var look_and_learn_unlocked: bool = unlock["look_and_learn"] == UserProgression.Status.Unlocked
|
||||
var exercice_unlock_1: bool = unlock["games"][0] == UserProgression.Status.Unlocked
|
||||
var exercice_unlock_2: bool = unlock["games"][1] == UserProgression.Status.Unlocked
|
||||
var exercice_unlock_3: bool = unlock["games"][2] == UserProgression.Status.Unlocked
|
||||
if look_and_learn_unlocked or exercice_unlock_1 or exercice_unlock_2 or exercice_unlock_3:
|
||||
starting_garden = garden_ind
|
||||
break
|
||||
else:
|
||||
starting_garden = transition_data.current_garden
|
||||
_back_to_correct_spot()
|
||||
|
||||
scroll_container.scroll_horizontal = garden_size * starting_garden
|
||||
scroll_beginning_garden = scroll_container.scroll_horizontal / garden_size
|
||||
|
||||
await OpeningCurtain.open()
|
||||
|
||||
_back_to_correct_spot()
|
||||
scroll_container.scroll_horizontal = garden_size * starting_garden
|
||||
MusicManager.play(MusicManager.Track.Garden)
|
||||
|
||||
|
||||
func _back_to_correct_spot() -> void:
|
||||
if transition_data.is_empty():
|
||||
if not transition_data:
|
||||
return
|
||||
starting_garden = transition_data.current_garden
|
||||
|
||||
await get_tree().process_frame
|
||||
|
||||
# Finds the button
|
||||
var lesson_ind: int = 1
|
||||
var lesson_button: LessonButton
|
||||
for garden_control in garden_parent.get_children():
|
||||
for i in garden_control.lesson_button_controls.size():
|
||||
if lesson_button:
|
||||
break
|
||||
if lesson_ind == transition_data.current_lesson_number:
|
||||
lesson_button = garden_control.lesson_button_controls[i]
|
||||
break
|
||||
lesson_ind += 1
|
||||
pass
|
||||
|
||||
# Re-open the minigames layout
|
||||
# If the minigame is completed: play an animation
|
||||
await _open_minigames_layout(null, transition_data.current_lesson_number, transition_data.current_garden, transition_data.current_button_global_position)
|
||||
await _open_minigames_layout(lesson_button, transition_data.current_lesson_number, transition_data.current_garden, transition_data.current_button_global_position)
|
||||
|
||||
# If the lesson is completed:
|
||||
# - close the layout TODO
|
||||
# - fill in the path towards the next lesson TODO
|
||||
# - enable the next lesson button TODO
|
||||
|
||||
if new_lesson_unlocked:
|
||||
var max_lesson: = UserDataManager.student_progression.get_max_unlocked_lesson()
|
||||
|
||||
# Close the layout
|
||||
await get_tree().create_timer(1.5).timeout
|
||||
await _close_minigames_layout()
|
||||
|
||||
lesson_ind = 1
|
||||
var last_lesson_button: LessonButton
|
||||
var new_lesson_button: LessonButton
|
||||
var is_last_lesson_of_garden: bool = false
|
||||
for garden_control in garden_parent.get_children():
|
||||
for i in garden_control.lesson_button_controls.size():
|
||||
if lesson_ind == max_lesson + 1:
|
||||
new_lesson_button = garden_control.lesson_button_controls[i]
|
||||
if lesson_ind == max_lesson :
|
||||
last_lesson_button = garden_control.lesson_button_controls[i]
|
||||
if i == garden_control.lesson_button_controls.size() -1:
|
||||
is_last_lesson_of_garden = true
|
||||
if last_lesson_button and new_lesson_button:
|
||||
break
|
||||
lesson_ind += 1
|
||||
if last_lesson_button and new_lesson_button:
|
||||
break
|
||||
|
||||
# Play an animation on the completed lesson
|
||||
if last_lesson_button:
|
||||
await last_lesson_button.right()
|
||||
|
||||
# Fill in the path towards the next lesson
|
||||
var curve: = Curve2D.new()
|
||||
for i in range(max_lesson-1, max_lesson + 1):
|
||||
curve.add_point(points[i][0], points[i][1], points[i][2])
|
||||
|
||||
var baked_points: = curve.get_baked_points()
|
||||
|
||||
# Check if we need to scroll to the next garden
|
||||
if is_last_lesson_of_garden:
|
||||
scroll_beginning_garden = scroll_container.scroll_horizontal / garden_size
|
||||
var target_scroll: int = scroll_beginning_garden * garden_size + garden_size
|
||||
var tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_IN_OUT)
|
||||
tween.tween_property(scroll_container, "scroll_horizontal", target_scroll, 4)
|
||||
scroll_beginning_garden = target_scroll / garden_size
|
||||
garden_parent.get_child(scroll_beginning_garden).pop_animation()
|
||||
|
||||
line_audio_stream_player.pitch_scale = 0.95
|
||||
for point: Vector2 in baked_points:
|
||||
if not line_audio_stream_player.playing:
|
||||
line_audio_stream_player.pitch_scale += 0.05
|
||||
line_audio_stream_player.play()
|
||||
unlocked_line.add_point(point)
|
||||
line_particles.position = point
|
||||
await get_tree().create_timer(0.01).timeout
|
||||
|
||||
# Enable the next lesson button
|
||||
if new_lesson_button:
|
||||
new_lesson_button.disabled = false
|
||||
|
||||
_unlock()
|
||||
|
||||
new_lesson_unlocked = false
|
||||
transition_data = {}
|
||||
|
||||
|
||||
@@ -158,23 +251,20 @@ func _open_minigames_layout(button: LessonButton, lesson_ind: int, garden_ind: i
|
||||
# Gets the current lesson unlocks
|
||||
var lesson_unlocks: Dictionary = UserDataManager.student_progression.unlocks[current_lesson_number]
|
||||
|
||||
var are_minigames_locked: bool = lesson_unlocks["games"][0] == UserProgression.Status.Locked and lesson_unlocks["games"][1] == UserProgression.Status.Locked and lesson_unlocks["games"][2] == UserProgression.Status.Locked
|
||||
|
||||
# Desactivate the mouse filters on the buttons behind the layout
|
||||
for b: LessonButton in garden.lesson_button_controls:
|
||||
b.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
|
||||
# Background
|
||||
if lesson_unlocks["games"][0] == UserProgression.Status.Locked and lesson_unlocks["games"][1] == UserProgression.Status.Locked and lesson_unlocks["games"][2] == UserProgression.Status.Locked:
|
||||
if are_minigames_locked:
|
||||
minigame_background_center.modulate = locked_color
|
||||
elif lesson_unlocks["games"][0] == UserProgression.Status.Completed and lesson_unlocks["games"][1] == UserProgression.Status.Completed and lesson_unlocks["games"][2] == UserProgression.Status.Completed:
|
||||
minigame_background_center.modulate = garden.color
|
||||
else:
|
||||
minigame_background_center.modulate = unlocked_color
|
||||
minigame_background_center.modulate = garden.color
|
||||
|
||||
# Lesson button
|
||||
lesson_button.text = lessons[current_lesson_number][0].grapheme
|
||||
lesson_button.completed_color = garden.color
|
||||
lesson_button.disabled = lesson_unlocks["look_and_learn"] == UserProgression.Status.Locked
|
||||
lesson_button.completed = lesson_unlocks["look_and_learn"] == UserProgression.Status.Completed
|
||||
_handle_lesson_button(current_lesson_number, lesson_unlocks["look_and_learn"], garden.color)
|
||||
|
||||
# Minigames
|
||||
_fill_minigame_choice(minigame_layout_1, exercises[0], lesson_unlocks["games"][0], 0)
|
||||
@@ -184,12 +274,19 @@ func _open_minigames_layout(button: LessonButton, lesson_ind: int, garden_ind: i
|
||||
# Animations
|
||||
minigame_selection.visible = true
|
||||
back_button.visible = false
|
||||
line_particles.visible = false
|
||||
|
||||
minigame_background.size = 300.0 * Vector2.ONE
|
||||
minigame_background.global_position = current_button_global_position
|
||||
minigame_background.visible = true
|
||||
|
||||
minigame_background_center.size = 300.0 * Vector2.ONE
|
||||
minigame_background_center.global_position = current_button_global_position
|
||||
minigame_background_center.visible = true
|
||||
|
||||
var tween: = create_tween().set_parallel(true).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
|
||||
tween.tween_property(minigame_background_center, "scale", (1800.0 / 300.0) * Vector2.ONE, 0.25)
|
||||
tween.tween_property(minigame_background_center, "global_position", Vector2(380.0, 0), 0.25)
|
||||
tween.tween_property(minigame_background, "scale", (1800.0 / 300.0) * Vector2.ONE, 0.25)
|
||||
tween.tween_property(minigame_background, "global_position", Vector2(380.0, 0), 0.25)
|
||||
tween.chain().tween_property(minigame_selection, "modulate:a", 1.0, 0.25)
|
||||
@@ -199,23 +296,37 @@ func _open_minigames_layout(button: LessonButton, lesson_ind: int, garden_ind: i
|
||||
minigame_layout_opened.emit()
|
||||
|
||||
|
||||
func _handle_lesson_button(current_lesson_number: int, status: UserProgression.Status, color: Color) -> void:
|
||||
lesson_button.text = lessons[current_lesson_number][0].grapheme
|
||||
lesson_button.completed_color = color
|
||||
|
||||
lesson_button.disabled = status == UserProgression.Status.Locked
|
||||
lesson_button.completed = status == UserProgression.Status.Completed
|
||||
lesson_button_particles.emitting = status == UserProgression.Status.Unlocked
|
||||
|
||||
if status == UserProgression.Status.Completed:
|
||||
if transition_data and transition_data.has("look_and_learn_completed") and transition_data.look_and_learn_completed:
|
||||
await minigame_layout_opened
|
||||
lesson_button.right()
|
||||
|
||||
|
||||
func _fill_minigame_choice(layout: MinigameLayout, exercise_type: int, status: UserProgression.Status, minigame_number: int) -> void:
|
||||
|
||||
layout.icon.texture = minigames_icons[exercise_type-1]
|
||||
layout.is_disabled = status == UserProgression.Status.Locked
|
||||
|
||||
if status == UserProgression.Status.Completed:
|
||||
layout.self_modulate = garden_parent.get_child(current_garden).color
|
||||
|
||||
#if transition_data and transition_data.minigame_completed and transition_data.minigame_number == minigame_number:
|
||||
# layout.self_modulate.a = 0
|
||||
# await minigame_layout_opened
|
||||
# # TODO REVOIR L'ANIMATION
|
||||
# var tween: = create_tween().tween_property(layout, "self_modulate:a", 1, 0.5)
|
||||
if transition_data and transition_data.has("minigame_completed") and transition_data.minigame_completed and transition_data.minigame_number == minigame_number:
|
||||
layout.self_modulate = unlocked_color
|
||||
await minigame_layout_opened
|
||||
var tween: = create_tween().tween_property(layout, "self_modulate:a", 0, 1)
|
||||
else:
|
||||
layout.self_modulate.a = 0
|
||||
|
||||
elif status == UserProgression.Status.Locked:
|
||||
layout.self_modulate = locked_color
|
||||
else:
|
||||
layout.self_modulate = Color(0.0, 0.0, 0.0, 0.0)
|
||||
layout.self_modulate = unlocked_color
|
||||
|
||||
layout.pressed.connect(_on_minigame_button_pressed.bind(minigames_scenes[exercise_type-1], minigame_number))
|
||||
|
||||
@@ -223,10 +334,15 @@ func _fill_minigame_choice(layout: MinigameLayout, exercise_type: int, status: U
|
||||
func _close_minigames_layout() -> void:
|
||||
if not in_minigame_selection:
|
||||
return
|
||||
|
||||
|
||||
feedback_audio_stream_player2.pitch_scale = 0.75
|
||||
feedback_audio_stream_player2.play()
|
||||
|
||||
var tween: = create_tween().set_parallel(true).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
|
||||
tween.tween_property(minigame_selection, "modulate:a", 0.0, 0.25)
|
||||
var other_tween: = tween.chain()
|
||||
other_tween.tween_property(minigame_background_center, "scale", Vector2.ONE, 0.25)
|
||||
other_tween.tween_property(minigame_background_center, "global_position", current_button_global_position, 0.25)
|
||||
other_tween.tween_property(minigame_background, "scale", Vector2.ONE, 0.25)
|
||||
other_tween.tween_property(minigame_background, "global_position", current_button_global_position, 0.25)
|
||||
await tween.finished
|
||||
@@ -236,10 +352,9 @@ func _close_minigames_layout() -> void:
|
||||
|
||||
minigame_selection.visible = false
|
||||
minigame_background.visible = false
|
||||
minigame_background_center.visible = false
|
||||
back_button.visible = true
|
||||
|
||||
# Handles lesson buttons
|
||||
_on_progression_unlocks_changed()
|
||||
line_particles.visible = true
|
||||
|
||||
for button in garden_parent.get_child(current_garden).lesson_button_controls:
|
||||
button.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
@@ -301,36 +416,7 @@ func set_up_path() -> void:
|
||||
locked_line.points = curve.get_baked_points()
|
||||
|
||||
|
||||
func _on_garden_lesson_button_pressed(button: LessonButton, lesson_ind: int, garden_ind: int, button_global_position: = Vector2.ZERO) -> void:
|
||||
# Play a sound TODO
|
||||
_open_minigames_layout(button, lesson_ind, garden_ind, button_global_position)
|
||||
|
||||
|
||||
func _on_lesson_button_pressed() -> void:
|
||||
await OpeningCurtain.close()
|
||||
|
||||
LookAndLearn.transition_data = {
|
||||
current_button_global_position = current_button_global_position,
|
||||
current_lesson_number = current_lesson_number,
|
||||
current_garden = current_garden,
|
||||
}
|
||||
get_tree().change_scene_to_packed(look_and_learn_scene)
|
||||
|
||||
|
||||
func _on_minigame_button_pressed(minigame_scene: PackedScene, minigame_number: int) -> void:
|
||||
await OpeningCurtain.close()
|
||||
|
||||
Minigame.transition_data = {
|
||||
current_button_global_position = current_button_global_position,
|
||||
current_lesson_number = current_lesson_number,
|
||||
current_garden = current_garden,
|
||||
minigame_number = minigame_number,
|
||||
minigame_completed = false
|
||||
}
|
||||
get_tree().change_scene_to_packed(minigame_scene)
|
||||
|
||||
|
||||
func _on_progression_unlocks_changed() -> void:
|
||||
func _set_progression() -> void:
|
||||
if not garden_parent:
|
||||
return
|
||||
|
||||
@@ -339,15 +425,15 @@ func _on_progression_unlocks_changed() -> void:
|
||||
|
||||
var lesson_ind: = 1
|
||||
for garden_control in garden_parent.get_children():
|
||||
if not lesson_ind in lessons:
|
||||
break
|
||||
var garden_unlocks: = 0.0
|
||||
var garden_total_unlocks: = 0.0
|
||||
for i in garden_control.lesson_button_controls.size():
|
||||
var button: LessonButton = garden_control.lesson_button_controls[i]
|
||||
if not lesson_ind in lessons:
|
||||
break
|
||||
button.disabled = true
|
||||
continue
|
||||
|
||||
if UserDataManager.student_progression.unlocks[lesson_ind]["look_and_learn"] >= UserProgression.Status.Unlocked:
|
||||
if UserDataManager.student_progression.unlocks[lesson_ind]["look_and_learn"] >= UserProgression.Status.Unlocked and not (new_lesson_unlocked and lesson_ind == UserDataManager.student_progression.get_max_unlocked_lesson() + 1):
|
||||
if UserDataManager.student_progression.unlocks[lesson_ind]["look_and_learn"] == UserProgression.Status.Unlocked:
|
||||
garden_unlocks += 1.0
|
||||
if UserDataManager.student_progression.unlocks[lesson_ind]["look_and_learn"] == UserProgression.Status.Completed:
|
||||
@@ -355,13 +441,13 @@ func _on_progression_unlocks_changed() -> void:
|
||||
garden_control.lesson_button_controls[i].disabled = false
|
||||
else:
|
||||
if ProjectSettings.get_setting_with_override("application/custom/unlock_everything"):
|
||||
garden_control.lesson_button_controls[i].disabled = false
|
||||
button.disabled = false
|
||||
else:
|
||||
garden_control.lesson_button_controls[i].disabled = true
|
||||
button.disabled = true
|
||||
|
||||
garden_total_unlocks += 2.0
|
||||
|
||||
garden_control.lesson_button_controls[i].completed = UserDataManager.student_progression.is_lesson_completed(lesson_ind)
|
||||
button.completed = UserDataManager.student_progression.is_lesson_completed(lesson_ind)
|
||||
|
||||
for k in range(3):
|
||||
garden_total_unlocks += 2.0
|
||||
@@ -373,6 +459,7 @@ func _on_progression_unlocks_changed() -> void:
|
||||
|
||||
lesson_ind += 1
|
||||
|
||||
# Handles the flowers
|
||||
var unlocks_ratio: = garden_unlocks / garden_total_unlocks
|
||||
var total_flowers: float = unlocks_ratio * garden_control.flower_controls.size() * 4.0
|
||||
var flower_ind: = 0
|
||||
@@ -387,13 +474,59 @@ func _on_progression_unlocks_changed() -> void:
|
||||
garden_control.flowers_sizes[flower_ind] = Garden.FlowerSizes.Small
|
||||
total_flowers -= 1.0
|
||||
flower_ind += 1
|
||||
|
||||
garden_control.update_flowers()
|
||||
|
||||
# Handles the path
|
||||
var curve: = Curve2D.new()
|
||||
for i in range(UserDataManager.student_progression.get_max_unlocked_lesson() + 1):
|
||||
var max_lesson: = UserDataManager.student_progression.get_max_unlocked_lesson()
|
||||
if not new_lesson_unlocked:
|
||||
max_lesson += 1
|
||||
|
||||
for i in range(max_lesson):
|
||||
curve.add_point(points[i][0], points[i][1], points[i][2])
|
||||
unlocked_line.points = curve.get_baked_points()
|
||||
|
||||
line_particles.position = unlocked_line.points[unlocked_line.points.size()-1]
|
||||
|
||||
func _lock() -> void:
|
||||
lock.visible = true
|
||||
|
||||
|
||||
func _unlock() -> void:
|
||||
lock.visible = false
|
||||
|
||||
|
||||
func _on_garden_lesson_button_pressed(button: LessonButton, lesson_ind: int, garden_ind: int, button_global_position: = Vector2.ZERO) -> void:
|
||||
feedback_audio_stream_player2.pitch_scale = 1.1
|
||||
feedback_audio_stream_player2.play()
|
||||
_open_minigames_layout(button, lesson_ind, garden_ind, button_global_position)
|
||||
|
||||
|
||||
func _on_lesson_button_pressed() -> void:
|
||||
feedback_audio_stream_player.play()
|
||||
await OpeningCurtain.close()
|
||||
|
||||
LookAndLearn.transition_data = {
|
||||
current_button_global_position = current_button_global_position,
|
||||
current_lesson_number = current_lesson_number,
|
||||
current_garden = current_garden,
|
||||
look_and_learn_completed = false
|
||||
}
|
||||
get_tree().change_scene_to_packed(look_and_learn_scene)
|
||||
|
||||
|
||||
func _on_minigame_button_pressed(minigame_scene: PackedScene, minigame_number: int) -> void:
|
||||
feedback_audio_stream_player.play()
|
||||
await OpeningCurtain.close()
|
||||
|
||||
Minigame.transition_data = {
|
||||
current_button_global_position = current_button_global_position,
|
||||
current_lesson_number = current_lesson_number,
|
||||
current_garden = current_garden,
|
||||
minigame_number = minigame_number,
|
||||
minigame_completed = false
|
||||
}
|
||||
get_tree().change_scene_to_packed(minigame_scene)
|
||||
|
||||
|
||||
func _on_scroll_container_gui_input(event: InputEvent) -> void:
|
||||
@@ -425,7 +558,10 @@ func _on_scroll_container_gui_input(event: InputEvent) -> void:
|
||||
if is_garden_changed:
|
||||
var garden_ind: int = target_scroll / garden_size
|
||||
garden_parent.get_child(garden_ind).pop_animation()
|
||||
|
||||
|
||||
await tween.finished
|
||||
scroll_beginning_garden = scroll_container.scroll_horizontal / garden_size
|
||||
|
||||
if is_scrolling and event is InputEventMouseMotion:
|
||||
scroll_container.scroll_horizontal -= event.relative.x
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
[ext_resource type="Script" path="res://sources/gardens/gardens_edit_tool.gd" id="2_gxq1k"]
|
||||
|
||||
[node name="GardensEditTool" instance=ExtResource("1_4b1e3")]
|
||||
mouse_filter = 2
|
||||
script = ExtResource("2_gxq1k")
|
||||
|
||||
[node name="HBoxContainer" parent="ScrollContainer" index="0"]
|
||||
|
||||
@@ -12,6 +12,7 @@ extends TextureButton
|
||||
@onready var center: TextureRect = %Center
|
||||
@onready var label: Label = %Label
|
||||
@onready var placeholder: TextureRect = %Placeholder
|
||||
@onready var right_fx: RightFX = %RightFX
|
||||
|
||||
func _ready():
|
||||
_set_base_color(base_color)
|
||||
@@ -24,6 +25,10 @@ func show_placeholder(is_shown: bool) -> void:
|
||||
label.visible = !is_shown
|
||||
|
||||
|
||||
func right() -> void:
|
||||
right_fx.play()
|
||||
await right_fx.finished
|
||||
|
||||
func _set_base_color(color: Color) -> void:
|
||||
base_color = color
|
||||
if center and not completed:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://delcgui3v0eek"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://delcgui3v0eek"]
|
||||
|
||||
[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"]
|
||||
@@ -6,6 +6,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://c0rumwiaimvxy" path="res://assets/theme/button_disabled.svg" id="4_4vg60"]
|
||||
[ext_resource type="Script" path="res://sources/lesson_screen/lesson_button.gd" id="4_mbltp"]
|
||||
[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"]
|
||||
|
||||
[node name="LessonButton" type="TextureButton"]
|
||||
z_index = 1
|
||||
@@ -23,6 +24,18 @@ script = ExtResource("4_mbltp")
|
||||
base_color = Color(0.109804, 0.14902, 0.384314, 1)
|
||||
completed_color = Color(0.109804, 0.14902, 0.384314, 1)
|
||||
|
||||
[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
|
||||
|
||||
@@ -143,6 +143,9 @@ func _on_tracing_manager_finished() -> void:
|
||||
animation_player.play("end_tracing")
|
||||
await animation_player.animation_finished
|
||||
|
||||
|
||||
gardens_data.look_and_learn_completed = true
|
||||
|
||||
_back_to_gardens()
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ const gardens_scene: = preload("res://sources/gardens/gardens.tscn")
|
||||
@export var unlocked_colors: Array[Color]
|
||||
@export var gardens_layout: GardensLayout
|
||||
|
||||
@onready var audio_stream_player: AudioStreamPlayer = $AudioStreamPlayer
|
||||
|
||||
@onready var garden_buttons: Array[TextureButton] = [
|
||||
%GardenButton1,
|
||||
%GardenButton2,
|
||||
@@ -76,7 +78,7 @@ func _ready() -> void:
|
||||
if can_emit and not emitting:
|
||||
emitting = false
|
||||
for game in UserDataManager.student_progression.unlocks[lesson_ind]["games"]:
|
||||
if game == UserProgression.Status.Locked:
|
||||
if game == UserProgression.Status.Unlocked or game == UserProgression.Status.Locked:
|
||||
emitting = true
|
||||
break
|
||||
lesson_ind += 1
|
||||
@@ -85,6 +87,7 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _on_garden_button_pressed(button_number: int) -> void:
|
||||
audio_stream_player.play()
|
||||
await OpeningCurtain.close()
|
||||
|
||||
var gardens: = gardens_scene.instantiate()
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
[gd_scene load_steps=40 format=3 uid="uid://dlqtn4yhqno8t"]
|
||||
[gd_scene load_steps=41 format=3 uid="uid://dlqtn4yhqno8t"]
|
||||
|
||||
[ext_resource type="Script" path="res://sources/menus/brain/brain.gd" id="1_1rwi2"]
|
||||
[ext_resource type="Texture2D" uid="uid://jlwblk7lj7vi" path="res://assets/vfx/fx_10.png" id="1_poeho"]
|
||||
[ext_resource type="Texture2D" uid="uid://dqjvrit8c3m6s" path="res://assets/brain_screen/blue_palm.png" id="2_6qag6"]
|
||||
[ext_resource type="Resource" uid="uid://8v0g8bpx5mh0" path="res://resources/gardens/gardens_layout.tres" id="2_qeplj"]
|
||||
[ext_resource type="Resource" uid="uid://8v0g8bpx5mh0" path="res://resources/gardens/gardens_layout_old.tres" id="2_qeplj"]
|
||||
[ext_resource type="Texture2D" uid="uid://crba20yq2ljox" path="res://assets/brain_screen/head.png" id="2_w21ae"]
|
||||
[ext_resource type="Texture2D" uid="uid://bjop68a8t82p3" path="res://assets/brain_screen/bush.png" id="3_bpmau"]
|
||||
[ext_resource type="AudioStream" uid="uid://bwjerrgyy6dnj" path="res://assets/sfx/ui_garden_button.mp3" id="3_f5uh7"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwqffehmm0eku" path="res://assets/brain_screen/button_garden_01.png" id="3_h8d14"]
|
||||
[ext_resource type="Texture2D" uid="uid://hh5mcytp75s5" path="res://assets/brain_screen/button_garden_02.png" id="4_0d7o0"]
|
||||
[ext_resource type="Texture2D" uid="uid://cb1tb1y336cej" path="res://assets/brain_screen/flower_1.png" id="4_tic4g"]
|
||||
@@ -91,6 +92,10 @@ locked_color = Color(0.000455221, 0.0669486, 0.35333, 1)
|
||||
unlocked_colors = Array[Color]([Color(0.588235, 0.439216, 0.878431, 1), Color(1, 0.909804, 0.137255, 1), Color(0.929412, 0.603922, 0.709804, 1), Color(0.658824, 0.262745, 0.286275, 1), Color(0.247059, 0.196078, 0.647059, 1), Color(0.619608, 0.976471, 0.670588, 1), Color(0.764706, 0.760784, 0.768627, 1), Color(1, 0.686275, 0.341176, 1), Color(0.305882, 0.996078, 0.894118, 1), Color(0.478431, 0.819608, 1, 1), Color(0.764706, 0.760784, 0.768627, 1), Color(1, 0.909804, 0.137255, 1), Color(0.658824, 0.262745, 0.286275, 1), Color(0.929412, 0.603922, 0.709804, 1), Color(0.619608, 0.976471, 0.670588, 1), Color(0.247059, 0.196078, 0.647059, 1), Color(0.305882, 0.996078, 0.894118, 1), Color(0.478431, 0.819608, 1, 1), Color(1, 0.686275, 0.341176, 1), Color(0.588235, 0.439216, 0.878431, 1)])
|
||||
gardens_layout = ExtResource("2_qeplj")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_f5uh7")
|
||||
bus = &"Effects"
|
||||
|
||||
[node name="ControlBackground" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
|
||||
@@ -201,6 +201,7 @@ func _on_stimulus_pressed(stimulus : Dictionary, _node : Node) -> bool:
|
||||
|
||||
# Handles the right answer GPs
|
||||
for i in right_answer.GPs.size():
|
||||
# TODO BUG WHEN STIMULUS IS SMALLER THAN TARGET
|
||||
if not stimulus.has("GPs") or (i <= stimulus.GPs.size() and stimulus.GPs[i] == right_answer.GPs[i]):
|
||||
continue
|
||||
_update_score(right_answer.GPs[i].ID, -1)
|
||||
|
||||
@@ -2,17 +2,25 @@ extends Node
|
||||
|
||||
@onready var music_player : AudioStreamPlayer = $MusicPlayer
|
||||
|
||||
const main_menu_music: AudioStream = preload("res://assets/menus/main/ui_title_card_music.mp3")
|
||||
const tracks: = [
|
||||
preload("res://assets/music/title.mp3"),
|
||||
preload("res://assets/music/garden.mp3")
|
||||
]
|
||||
|
||||
enum Track {
|
||||
Title,
|
||||
Garden
|
||||
}
|
||||
|
||||
func _ready() -> void:
|
||||
play(main_menu_music)
|
||||
play(Track.Title)
|
||||
|
||||
func _on_music_player_finished() -> void:
|
||||
music_player.stream_paused = false
|
||||
music_player.play()
|
||||
|
||||
func play(music : AudioStream) -> void:
|
||||
music_player.stream = music
|
||||
func play(track : Track) -> void:
|
||||
music_player.stream = tracks[track]
|
||||
music_player.play()
|
||||
|
||||
func stop() -> void:
|
||||
|
||||