Better UI
This commit is contained in:
@@ -210,7 +210,7 @@ func set_current_progression(p_current_progression: int) -> void:
|
||||
var previous_progression: = current_progression
|
||||
current_progression = p_current_progression
|
||||
if minigame_ui:
|
||||
minigame_ui.set_current_progression(p_current_progression)
|
||||
minigame_ui.set_progression(p_current_progression)
|
||||
if p_current_progression == max_progression and previous_progression != max_progression:
|
||||
await _win()
|
||||
else:
|
||||
|
||||
@@ -20,9 +20,6 @@ script = ExtResource("1_jdfsm")
|
||||
|
||||
[node name="OpeningCurtain" parent="." instance=ExtResource("3_p5ryr")]
|
||||
|
||||
[node name="StimuliFinder" type="Node" parent="."]
|
||||
process_mode = 3
|
||||
|
||||
[node name="GameRoot" type="Control" parent="."]
|
||||
process_mode = 1
|
||||
layout_mode = 1
|
||||
|
||||
@@ -16,6 +16,9 @@ signal effects_volume_changed(volume: float)
|
||||
signal kalulu_button_pressed
|
||||
signal kalulu_speech_ended
|
||||
|
||||
const empty_lives_icon: = preload("res://assets/minigames/minigame_ui/graphic/life_empty.png")
|
||||
const full_lives_icon: = preload("res://assets/minigames/minigame_ui/graphic/life.png")
|
||||
|
||||
@export var empty_progression_icon: Texture
|
||||
@export var full_progression_icon: Texture
|
||||
|
||||
@@ -28,11 +31,6 @@ signal kalulu_speech_ended
|
||||
|
||||
#Right panel
|
||||
@onready var volume_button: TextureButton = %VolumeButton
|
||||
@onready var empty_lives_rect: TextureRect = %EmptyLivesRect
|
||||
@onready var lives_rect: TextureRect = %LivesRect
|
||||
@onready var progression_gauge: NinePatchRect = %ProgressionGauge
|
||||
@onready var progression_empty_icons_rect: TextureRect = %ProgressionEmptyIconsRect
|
||||
@onready var progression_full_icons_rect: TextureRect = %ProgressionFullIconsRect
|
||||
|
||||
# Center menu
|
||||
@onready var center_menu: MarginContainer = %CenterMenu
|
||||
@@ -48,28 +46,10 @@ signal kalulu_speech_ended
|
||||
# Kalulu
|
||||
@onready var kalulu: Control = %Kalulu
|
||||
|
||||
# Lives management
|
||||
var empty_life_size: = 0.0
|
||||
var life_size: = 0.0
|
||||
|
||||
# Progression management
|
||||
var progression_gauge_unit_size: = 0.0
|
||||
var progression_empty_icon_size: = 0.0
|
||||
var progression_full_icon_size: = 0.0
|
||||
|
||||
# ------------ Initialisation ------------
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
progression_empty_icons_rect.texture = empty_progression_icon
|
||||
progression_full_icons_rect.texture = full_progression_icon
|
||||
|
||||
empty_life_size = empty_lives_rect.custom_minimum_size.x
|
||||
life_size = lives_rect.custom_minimum_size.x
|
||||
|
||||
progression_gauge_unit_size = progression_gauge.custom_minimum_size.y
|
||||
progression_empty_icon_size = progression_empty_icons_rect.custom_minimum_size.y
|
||||
progression_full_icon_size = progression_full_icons_rect.custom_minimum_size.y
|
||||
@onready var progression_container: = %ProgressionContainer
|
||||
@onready var model_progression_rect: = %ProgressionIconsRect
|
||||
@onready var lives_container: = %LivesContainer
|
||||
@onready var model_lives_rect: = %LivesIconsRect
|
||||
|
||||
|
||||
# ------------ Lock/Unlock ------------
|
||||
@@ -93,39 +73,56 @@ func unlock() -> void:
|
||||
|
||||
|
||||
func set_maximum_number_of_lives(new_max_number_of_lives: int) -> void:
|
||||
empty_lives_rect.custom_minimum_size.x = new_max_number_of_lives * empty_life_size
|
||||
if new_max_number_of_lives <= 0:
|
||||
empty_lives_rect.visible = false
|
||||
else:
|
||||
empty_lives_rect.visible = true
|
||||
var lives_rects: = lives_container.get_children()
|
||||
# Never remove the first
|
||||
for i in range(1, lives_rects.size()):
|
||||
if i >= new_max_number_of_lives:
|
||||
lives_rects[i].queue_free()
|
||||
for i in range(lives_rects.size(), new_max_number_of_lives):
|
||||
var new_lives_rect: = model_lives_rect.duplicate()
|
||||
new_lives_rect.texture = full_lives_icon
|
||||
lives_container.add_child(new_lives_rect)
|
||||
model_lives_rect.visible = new_max_number_of_lives >= 1
|
||||
|
||||
|
||||
func set_number_of_lives(new_number_of_lives: int) -> void:
|
||||
lives_rect.custom_minimum_size.x = new_number_of_lives * life_size
|
||||
if new_number_of_lives <= 0:
|
||||
lives_rect.visible = false
|
||||
else:
|
||||
lives_rect.visible = true
|
||||
var max_lives: = lives_container.get_child_count()
|
||||
if new_number_of_lives > max_lives:
|
||||
set_maximum_number_of_lives(new_number_of_lives)
|
||||
var lives_rects: = lives_container.get_children()
|
||||
for i in max_lives:
|
||||
if i < max_lives - new_number_of_lives:
|
||||
lives_rects[i].texture = empty_lives_icon
|
||||
else:
|
||||
lives_rects[i].texture = full_lives_icon
|
||||
|
||||
|
||||
# ------------ Progression ------------
|
||||
|
||||
|
||||
func set_max_progression(new_max_progression: int) -> void:
|
||||
progression_gauge.custom_minimum_size.y = new_max_progression * progression_gauge_unit_size
|
||||
progression_empty_icons_rect.custom_minimum_size.y = new_max_progression * progression_gauge_unit_size
|
||||
if new_max_progression <= 0:
|
||||
progression_empty_icons_rect.visible = false
|
||||
else:
|
||||
progression_empty_icons_rect.visible = true
|
||||
var progression_rects: = progression_container.get_children()
|
||||
# Never remove the first
|
||||
for i in range(1, progression_rects.size()):
|
||||
if i >= new_max_progression:
|
||||
progression_rects[i].queue_free()
|
||||
for i in range(progression_rects.size(), new_max_progression):
|
||||
var new_progression_rect: = model_progression_rect.duplicate()
|
||||
new_progression_rect.texture = empty_progression_icon
|
||||
progression_container.add_child(new_progression_rect)
|
||||
model_progression_rect.visible = new_max_progression >= 1
|
||||
|
||||
|
||||
func set_current_progression(new_current_progression: int) -> void:
|
||||
progression_full_icons_rect.custom_minimum_size.y = new_current_progression * progression_full_icon_size
|
||||
if new_current_progression <= 0:
|
||||
progression_full_icons_rect.visible = false
|
||||
else:
|
||||
progression_full_icons_rect.visible = true
|
||||
func set_progression(new_progression: int) -> void:
|
||||
var max_progression: = progression_container.get_child_count()
|
||||
if new_progression > max_progression:
|
||||
set_max_progression(new_progression)
|
||||
var progression_rects: = progression_container.get_children()
|
||||
for i in max_progression:
|
||||
if i < new_progression:
|
||||
progression_rects[i].texture = full_progression_icon
|
||||
else:
|
||||
progression_rects[i].texture = empty_progression_icon
|
||||
|
||||
|
||||
# ------------ Left Panel ------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=27 format=3 uid="uid://cweny8on01s4o"]
|
||||
[gd_scene load_steps=28 format=3 uid="uid://weree6bnlt6f"]
|
||||
|
||||
[ext_resource type="Script" path="res://sources/minigames/base/minigame_ui.gd" id="1_g5fl4"]
|
||||
[ext_resource type="Texture2D" uid="uid://dj0ygi5q6kbdw" path="res://assets/minigames/minigame_ui/graphic/button_back_to_menu_up.png" id="2_p2m3v"]
|
||||
@@ -19,17 +19,20 @@
|
||||
[ext_resource type="Texture2D" uid="uid://dqtmyedk1ylbw" path="res://assets/minigames/minigame_ui/graphic/button_replay_up.png" id="17_ipxst"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvu8ud6hkwusb" path="res://assets/minigames/minigame_ui/graphic/button_replay_down.png" id="18_5pefo"]
|
||||
[ext_resource type="Texture2D" uid="uid://d4ffd4us2hrbs" path="res://assets/minigames/minigame_ui/graphic/button_replay_disabled.png" id="19_mm65c"]
|
||||
[ext_resource type="PackedScene" uid="uid://blos4rn53qkwg" path="res://sources/minigames/base/kalulu.tscn" id="19_wn4nd"]
|
||||
[ext_resource type="PackedScene" uid="uid://c4t2cq5vyj4ai" path="res://sources/minigames/base/kalulu.tscn" id="19_wn4nd"]
|
||||
[ext_resource type="Texture2D" uid="uid://db64tlixplfru" path="res://assets/minigames/minigame_ui/graphic/life_empty.png" id="20_jyeyb"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkvf2b6b1keqf" path="res://assets/minigames/minigame_ui/graphic/volume_up.png" id="20_qsa3m"]
|
||||
[ext_resource type="Texture2D" uid="uid://blgoagm5j5jh2" path="res://assets/minigames/minigame_ui/graphic/volume_down.png" id="21_g5me6"]
|
||||
[ext_resource type="Texture2D" uid="uid://3om2awlftpxd" path="res://assets/minigames/minigame_ui/graphic/life.png" id="21_p2p43"]
|
||||
[ext_resource type="Texture2D" uid="uid://dxqnvbr4tffn7" path="res://assets/minigames/minigame_ui/graphic/gauge.png" id="22_6jd5r"]
|
||||
[ext_resource type="Texture2D" uid="uid://cuxo6l6hmin1y" path="res://assets/minigames/minigame_ui/graphic/volume_disabled.png" id="22_vw7wh"]
|
||||
[ext_resource type="Texture2D" uid="uid://c3o1aolewrm4k" path="res://assets/minigames/monkeys/graphic/gauge_icon_monkey_empty.png" id="26_0bgo4"]
|
||||
[ext_resource type="Texture2D" uid="uid://c3okdxpi317x5" path="res://assets/minigames/monkeys/graphic/gauge_icon_monkey_full.png" id="27_eee4l"]
|
||||
|
||||
[node name="MinigameUI" type="CanvasLayer"]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_g5fl4")
|
||||
empty_progression_icon = ExtResource("26_0bgo4")
|
||||
full_progression_icon = ExtResource("27_eee4l")
|
||||
|
||||
[node name="MainControl" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
@@ -40,8 +43,8 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Interface" type="HBoxContainer" parent="MainControl"]
|
||||
layout_mode = 0
|
||||
[node name="Interface" type="Control" parent="MainControl"]
|
||||
anchors_preset = 0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
@@ -49,7 +52,12 @@ grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="LeftMargin" type="MarginContainer" parent="MainControl/Interface"]
|
||||
layout_mode = 2
|
||||
custom_minimum_size = Vector2(450, 2.08165e-12)
|
||||
layout_mode = 1
|
||||
anchors_preset = 9
|
||||
anchor_bottom = 1.0
|
||||
offset_right = 300.0
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 2.0
|
||||
mouse_filter = 2
|
||||
@@ -87,6 +95,17 @@ texture_pressed = ExtResource("6_ojtbv")
|
||||
texture_disabled = ExtResource("7_cg081")
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="VolumeContainer" type="MarginContainer" parent="MainControl/Interface/LeftMargin/LeftContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VolumeButton" type="TextureButton" parent="MainControl/Interface/LeftMargin/LeftContainer/VolumeContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
texture_normal = ExtResource("20_qsa3m")
|
||||
texture_pressed = ExtResource("21_g5me6")
|
||||
texture_disabled = ExtResource("22_vw7wh")
|
||||
|
||||
[node name="PauseMargin" type="MarginContainer" parent="MainControl/Interface/LeftMargin/LeftContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 5
|
||||
@@ -113,10 +132,18 @@ texture_disabled = ExtResource("13_2j53i")
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="CentralPadMargin" type="MarginContainer" parent="MainControl/Interface"]
|
||||
layout_mode = 2
|
||||
layout_mode = 1
|
||||
anchors_preset = 13
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -897.0
|
||||
offset_right = 897.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 7
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 10.0
|
||||
size_flags_stretch_ratio = 9.0
|
||||
mouse_filter = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 20
|
||||
@@ -185,107 +212,82 @@ texture_normal = ExtResource("17_ipxst")
|
||||
texture_pressed = ExtResource("18_5pefo")
|
||||
texture_disabled = ExtResource("19_mm65c")
|
||||
|
||||
[node name="RightMargin" type="MarginContainer" parent="MainControl/Interface"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
mouse_filter = 2
|
||||
theme_override_constants/margin_left = 50
|
||||
theme_override_constants/margin_top = 50
|
||||
theme_override_constants/margin_right = 50
|
||||
theme_override_constants/margin_bottom = 50
|
||||
|
||||
[node name="RightContainer" type="VBoxContainer" parent="MainControl/Interface/RightMargin"]
|
||||
layout_mode = 2
|
||||
[node name="ProgressionMargin" type="MarginContainer" parent="MainControl/Interface"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -210.0
|
||||
offset_bottom = 962.0
|
||||
grow_horizontal = 0
|
||||
size_flags_horizontal = 8
|
||||
mouse_filter = 2
|
||||
theme_override_constants/margin_top = 270
|
||||
theme_override_constants/margin_right = 40
|
||||
|
||||
[node name="VolumeContainer" type="MarginContainer" parent="MainControl/Interface/RightMargin/RightContainer"]
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MainControl/Interface/ProgressionMargin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 50
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="VolumeButton" type="TextureButton" parent="MainControl/Interface/RightMargin/RightContainer/VolumeContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 4
|
||||
texture_normal = ExtResource("20_qsa3m")
|
||||
texture_pressed = ExtResource("21_g5me6")
|
||||
texture_disabled = ExtResource("22_vw7wh")
|
||||
|
||||
[node name="LivesContainer" type="MarginContainer" parent="MainControl/Interface/RightMargin/RightContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
theme_override_constants/margin_left = 25
|
||||
theme_override_constants/margin_top = 75
|
||||
theme_override_constants/margin_right = 25
|
||||
theme_override_constants/margin_bottom = 50
|
||||
|
||||
[node name="EmptyLivesRect" type="TextureRect" parent="MainControl/Interface/RightMargin/RightContainer/LivesContainer"]
|
||||
unique_name_in_owner = true
|
||||
[node name="ProgressionGauge" type="NinePatchRect" parent="MainControl/Interface/ProgressionMargin/MarginContainer"]
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("20_jyeyb")
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="LivesRect" type="TextureRect" parent="MainControl/Interface/RightMargin/RightContainer/LivesContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("21_p2p43")
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="ProgressionMargin" type="MarginContainer" parent="MainControl/Interface/RightMargin/RightContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="ProgressionGauge" type="NinePatchRect" parent="MainControl/Interface/RightMargin/RightContainer/ProgressionMargin"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 0
|
||||
texture = ExtResource("22_6jd5r")
|
||||
patch_margin_top = 33
|
||||
patch_margin_bottom = 33
|
||||
|
||||
[node name="ProgressionEmptyIconsRect" type="TextureRect" parent="MainControl/Interface/RightMargin/RightContainer/ProgressionMargin"]
|
||||
[node name="ProgressionContainer" type="VBoxContainer" parent="MainControl/Interface/ProgressionMargin/MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
custom_minimum_size = Vector2(170, 2.08165e-12)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="ProgressionFullIconsRect" type="TextureRect" parent="MainControl/Interface/RightMargin/RightContainer/ProgressionMargin"]
|
||||
[node name="ProgressionIconsRect" type="TextureRect" parent="MainControl/Interface/ProgressionMargin/MarginContainer/ProgressionContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
stretch_mode = 1
|
||||
texture = ExtResource("27_eee4l")
|
||||
expand_mode = 4
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="LivesMargin" type="MarginContainer" parent="MainControl/Interface"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 1
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
offset_left = -200.0
|
||||
offset_bottom = 114.0
|
||||
grow_horizontal = 0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 2.0
|
||||
mouse_filter = 2
|
||||
theme_override_constants/margin_top = 50
|
||||
theme_override_constants/margin_right = 40
|
||||
|
||||
[node name="LivesContainer" type="HBoxContainer" parent="MainControl/Interface/LivesMargin"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(2.08165e-12, 130)
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="LivesIconsRect" type="TextureRect" parent="MainControl/Interface/LivesMargin/LivesContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
texture = ExtResource("20_jyeyb")
|
||||
expand_mode = 2
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="VolumeMenu" type="Control" parent="MainControl"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
anchors_preset = 0
|
||||
offset_left = 2006.0
|
||||
offset_top = 266.0
|
||||
offset_right = 2487.0
|
||||
offset_bottom = 722.0
|
||||
offset_left = 357.0
|
||||
offset_top = 683.0
|
||||
offset_right = 838.0
|
||||
offset_bottom = 1139.0
|
||||
|
||||
[node name="Panel" type="Panel" parent="MainControl/VolumeMenu"]
|
||||
layout_mode = 2
|
||||
@@ -421,10 +423,10 @@ layout_mode = 1
|
||||
|
||||
[connection signal="pressed" from="MainControl/Interface/LeftMargin/LeftContainer/GardenButton" to="." method="_on_garden_button_pressed"]
|
||||
[connection signal="pressed" from="MainControl/Interface/LeftMargin/LeftContainer/StimulusMargin/StimulusButton" to="." method="_on_stimulus_button_pressed"]
|
||||
[connection signal="pressed" from="MainControl/Interface/LeftMargin/LeftContainer/VolumeContainer/VolumeButton" to="." method="_on_volume_button_pressed"]
|
||||
[connection signal="pressed" from="MainControl/Interface/LeftMargin/LeftContainer/PauseMargin/PauseButton" to="." method="_on_pause_button_pressed"]
|
||||
[connection signal="pressed" from="MainControl/Interface/LeftMargin/LeftContainer/KaluluButton" to="." method="_on_kalulu_button_pressed"]
|
||||
[connection signal="pressed" from="MainControl/Interface/CentralPadMargin/CenterMenu/MarginContainer2/VBoxContainer/MarginContainer/RestartButton" to="." method="_on_restart_button_pressed"]
|
||||
[connection signal="pressed" from="MainControl/Interface/RightMargin/RightContainer/VolumeContainer/VolumeButton" to="." method="_on_volume_button_pressed"]
|
||||
[connection signal="value_changed" from="MainControl/VolumeMenu/VBoxContainer/MasterVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/MasterVolumeSlider" to="." method="_on_master_volume_slider_value_changed"]
|
||||
[connection signal="value_changed" from="MainControl/VolumeMenu/VBoxContainer/MusicVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/MusicVolumeSlider" to="." method="_on_music_volume_slider_value_changed"]
|
||||
[connection signal="value_changed" from="MainControl/VolumeMenu/VBoxContainer/VoiceVolumeMarginContainer/VBoxContainer/HBoxContainer/MarginContainer/VoiceVolumeSlider" to="." method="_on_voice_volume_slider_value_changed"]
|
||||
|
||||
@@ -8,6 +8,7 @@ signal dragged_into(vector, monkey)
|
||||
const instance_scene: = "res://sources/minigames/monkeys/monkey.tscn"
|
||||
|
||||
@onready var coconut: = $Marker2D/Coconut
|
||||
@onready var coconut_pivot: = $Marker2D
|
||||
@onready var animation_player: = $AnimationPlayer
|
||||
@onready var drag_preview_label: = $Button/DragPreview/Label
|
||||
@onready var drag_preview: = $Button/DragPreview
|
||||
@@ -28,6 +29,7 @@ var stimulus: Dictionary :
|
||||
stimulus = value
|
||||
coconut.text = value.Grapheme
|
||||
drag_preview_label.text = value.Grapheme
|
||||
coconut_pivot.hide()
|
||||
|
||||
|
||||
static func instantiate():
|
||||
|
||||
@@ -231,6 +231,7 @@ func _on_wrong_coconut(coconut: Node2D, monkey: Monkey) -> void:
|
||||
tween.tween_property(coconut, "global_position", monkey.hit_position.global_position, throw_to_monkey_duration).set_trans(Tween.TRANS_LINEAR)
|
||||
await tween.finished
|
||||
await monkey.hit(coconut)
|
||||
current_lives -= 1
|
||||
coconut.queue_free()
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ throw_to_king_duration = 1.2
|
||||
throw_to_monkey_duration = 0.8
|
||||
throw_to_planck_duration = 0.9
|
||||
max_number_of_lives = 5
|
||||
max_progression = 1
|
||||
max_progression = 2
|
||||
help_kalulu_speech = ExtResource("3_hhwrg")
|
||||
win_kalulu_speech = ExtResource("4_oe2vh")
|
||||
|
||||
|
||||
@@ -92,10 +92,7 @@ func _setup_minigame() -> void:
|
||||
|
||||
# Find the stimuli and distractions of the minigame.
|
||||
func _find_stimuli_and_distractions() -> void:
|
||||
var before: = Database.get_GP_before_lesson(lesson_nb)
|
||||
var current: = Database.get_GP_for_lesson(lesson_nb)
|
||||
before.append_array(current)
|
||||
stimuli = Database.copy_without_double_graphemes(before)
|
||||
stimuli = Database.get_GP_before_and_for_lesson(lesson_nb, true)
|
||||
|
||||
|
||||
func _start() -> void:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://ek0ri3b6vwj1"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://ek0ri3b6vwj1"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://8awe4usnucyv" path="res://sources/minigames/base/base_minigame.tscn" id="1_oeg4r"]
|
||||
[ext_resource type="Script" path="res://sources/minigames/parakeets/parakeets_minigame.gd" id="2_x6xn5"]
|
||||
@@ -7,17 +7,23 @@
|
||||
[ext_resource type="AudioStream" uid="uid://c58a2q8b26vpn" path="res://assets/minigames/parakeets/audio/kalulu_end_parakeets_language.mp3" id="4_01e28"]
|
||||
[ext_resource type="Texture2D" uid="uid://clvh07xfgjmri" path="res://assets/minigames/parakeets/graphic/tree_trunk.png" id="4_unuga"]
|
||||
[ext_resource type="Texture2D" uid="uid://d3n327me83on7" path="res://assets/minigames/parakeets/graphic/tree_branch.png" id="5_46kss"]
|
||||
[ext_resource type="Texture2D" uid="uid://dpx72xoqt8lkq" path="res://assets/minigames/parakeets/graphic/gauge_icon_parakeet_empty.png" id="5_yt7mv"]
|
||||
[ext_resource type="Texture2D" uid="uid://di2qcv6jw8wh0" path="res://assets/minigames/parakeets/graphic/gauge_icon_parakeet_full.png" id="6_46vnr"]
|
||||
[ext_resource type="Texture2D" uid="uid://sjxhvbq8ijbw" path="res://assets/minigames/parakeets/graphic/nest_back.png" id="6_g64mq"]
|
||||
[ext_resource type="Texture2D" uid="uid://ctvnu3s3sgwwf" path="res://assets/minigames/parakeets/graphic/nest_front.png" id="7_3mibn"]
|
||||
|
||||
[node name="Parakeets" instance=ExtResource("1_oeg4r")]
|
||||
script = ExtResource("2_x6xn5")
|
||||
max_number_of_lives = 5
|
||||
help_kalulu_speech = ExtResource("3_ofxb4")
|
||||
win_kalulu_speech = ExtResource("4_01e28")
|
||||
difficulty = 4
|
||||
lesson_nb = 4
|
||||
fly_duration = 3.0
|
||||
max_number_of_lives = 5
|
||||
help_kalulu_speech = ExtResource("3_ofxb4")
|
||||
win_kalulu_speech = ExtResource("4_01e28")
|
||||
|
||||
[node name="MinigameUI" parent="." index="1"]
|
||||
empty_progression_icon = ExtResource("5_yt7mv")
|
||||
full_progression_icon = ExtResource("6_46vnr")
|
||||
|
||||
[node name="Background" type="TextureRect" parent="GameRoot" index="0"]
|
||||
layout_mode = 1
|
||||
|
||||
@@ -40,6 +40,14 @@ func get_GP_before_lesson(lesson_nb: int, distinct: bool) -> Array:
|
||||
return db.query_result
|
||||
|
||||
|
||||
func get_GP_before_and_for_lesson(lesson_nb: int, distinct: bool) -> Array:
|
||||
var query: = "Select Grapheme, Phoneme, LessonNb FROM GPs INNER JOIN Lessons ON Lessons.GPID = GPs.ID AND Lessons.LessonNb <= ?"
|
||||
if distinct:
|
||||
query += "GROUP BY Grapheme"
|
||||
db.query_with_bindings(query, [lesson_nb])
|
||||
return db.query_result
|
||||
|
||||
|
||||
func get_GP_from_word(word: String) -> Array:
|
||||
db.query_with_bindings("SELECT Grapheme, Phoneme FROM Words INNER JOIN GPsInWords ON Words.ID = GPsInWords.WordID AND Words.Word=? INNER JOIN GPs WHERE GPS.ID = GPsInWords.GPID ORDER BY Position", [word])
|
||||
return db.query_result
|
||||
|
||||
Reference in New Issue
Block a user