Fixes a visual bug on the penguin minigame
This commit is contained in:
@@ -93,7 +93,6 @@ func _get_new_sentence() -> void:
|
||||
await audio_player.finished
|
||||
|
||||
await _next_sentence()
|
||||
await _play_current_sentence()
|
||||
await _start_ants()
|
||||
|
||||
|
||||
@@ -103,14 +102,14 @@ func _next_sentence() -> void:
|
||||
nodes.append_array(words.get_children())
|
||||
for node in nodes:
|
||||
node.queue_free()
|
||||
|
||||
for i in ants.get_child_count():
|
||||
var ant: Ant = ants.get_child(i)
|
||||
|
||||
for ant: Ant in ants.get_children():
|
||||
ant.walk()
|
||||
var tween: = create_tween()
|
||||
tween.tween_property(ant, "global_position", ants_despawn.global_position, 1.0)
|
||||
await tween.finished
|
||||
ant.queue_free()
|
||||
await ant.tree_exited
|
||||
|
||||
await get_tree().process_frame
|
||||
|
||||
@@ -174,13 +173,6 @@ func _next_sentence() -> void:
|
||||
label.label_settings = label_settings
|
||||
|
||||
|
||||
func _play_current_sentence() -> void:
|
||||
#audio_player.stream = Database.get_audio_stream_for_sentence(current_sentence)
|
||||
#audio_player.play()
|
||||
if audio_player.playing:
|
||||
await audio_player.finished
|
||||
|
||||
|
||||
func _start_ants() -> void:
|
||||
var number_of_ants: = ants.get_child_count()
|
||||
for i in range(number_of_ants):
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
[node name="AntsMinigame" instance=ExtResource("1_jqkff")]
|
||||
script = ExtResource("2_05d1y")
|
||||
minigame_name = 7
|
||||
lesson_nb = 50
|
||||
lesson_nb = 60
|
||||
max_number_of_lives = 5
|
||||
max_progression = 3
|
||||
|
||||
|
||||
@@ -10,6 +10,3 @@ distractors_queue_size = 6
|
||||
time_between_words = 3.0
|
||||
lesson_nb = 4
|
||||
difficulty = 1
|
||||
|
||||
[node name="AudioStreamPlayer" parent="." index="0"]
|
||||
process_mode = 3
|
||||
|
||||
@@ -7,11 +7,15 @@ signal pressed(pos: Vector2)
|
||||
@onready var button: Button = $Button
|
||||
|
||||
var gp: Dictionary
|
||||
var capitalized: bool = false
|
||||
var is_pressed: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
if gp:
|
||||
text = gp.Grapheme
|
||||
if capitalized:
|
||||
text = gp.Grapheme.capitalize()
|
||||
else:
|
||||
text = gp.Grapheme
|
||||
|
||||
|
||||
func set_button_enabled(is_enabled: bool) -> void:
|
||||
|
||||
@@ -8,8 +8,9 @@ const label_scene: PackedScene = preload("res://sources/minigames/penguin/pengui
|
||||
|
||||
const silent_phoneme: = "#"
|
||||
|
||||
|
||||
@onready var penguin: Penguin = $GameRoot/Penguin
|
||||
@onready var labels_container: HBoxContainer = $GameRoot/Control/LabelsContainer
|
||||
@onready var labels_container: HFlowContainer = $GameRoot/Control/LabelsContainer
|
||||
|
||||
var current_word_progression: int = 0: set = _set_current_word_progression
|
||||
var max_word_progression: int = 0
|
||||
@@ -70,11 +71,11 @@ func _find_stimuli_and_distractions() -> void:
|
||||
# Shuffle the stimuli
|
||||
stimuli.shuffle()
|
||||
|
||||
print(stimuli)
|
||||
|
||||
# Find the GPs and distractors for each word
|
||||
for sentence: Dictionary in stimuli:
|
||||
sentence.GPs = Database.get_GPs_from_sentence(sentence.ID as int)
|
||||
|
||||
print(stimuli)
|
||||
|
||||
|
||||
# Launch the minigame
|
||||
@@ -95,8 +96,10 @@ func _setup_word_progression() -> void:
|
||||
|
||||
var stimulus: = _get_current_stimulus()
|
||||
|
||||
var first_GP: bool = true
|
||||
var last_wordID: int
|
||||
var word_container: HBoxContainer
|
||||
|
||||
for GP: Dictionary in stimulus.GPs:
|
||||
if GP.WordID != last_wordID:
|
||||
last_wordID = GP.WordID
|
||||
@@ -104,6 +107,9 @@ func _setup_word_progression() -> void:
|
||||
labels_container.add_child(word_container)
|
||||
|
||||
var label: PenguinLabel = label_scene.instantiate()
|
||||
if first_GP:
|
||||
label.capitalized = true
|
||||
first_GP = false
|
||||
label.gp = GP
|
||||
word_container.add_child(label)
|
||||
|
||||
@@ -111,8 +117,9 @@ func _setup_word_progression() -> void:
|
||||
|
||||
labels.append(label)
|
||||
|
||||
if GP.Phoneme == silent_phoneme:
|
||||
if GP.Type == 0:
|
||||
max_word_progression += 1
|
||||
|
||||
current_word_progression = 0
|
||||
|
||||
|
||||
@@ -135,7 +142,7 @@ func _get_current_stimulus() -> Dictionary:
|
||||
|
||||
|
||||
func _is_silent(gp: Dictionary) -> bool:
|
||||
return gp.Phoneme == silent_phoneme
|
||||
return gp.Type == 0
|
||||
|
||||
|
||||
func _set_current_word_progression(p_current_word_progression: int) -> void:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
[node name="PenguinMinigame" instance=ExtResource("1_s6yuv")]
|
||||
script = ExtResource("2_ncha4")
|
||||
minigame_name = 8
|
||||
lesson_nb = 15
|
||||
lesson_nb = 14
|
||||
max_number_of_lives = 5
|
||||
max_progression = 5
|
||||
|
||||
@@ -47,17 +47,14 @@ offset_bottom = -680.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="LabelsContainer" type="HBoxContainer" parent="GameRoot/Control" index="0"]
|
||||
[node name="LabelsContainer" type="HFlowContainer" parent="GameRoot/Control" index="0"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchors_preset = 14
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -314.0
|
||||
offset_top = -305.0
|
||||
offset_right = 314.0
|
||||
offset_bottom = 305.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 60
|
||||
theme_override_constants/h_separation = 48
|
||||
theme_override_constants/v_separation = 20
|
||||
alignment = 1
|
||||
|
||||
Reference in New Issue
Block a user