Fix small bugs

This commit is contained in:
BimDav
2023-03-28 14:21:51 +02:00
parent 076e59df7b
commit b032bdcc1d
6 changed files with 142 additions and 5 deletions
+2
View File
@@ -177,8 +177,10 @@ func _on_minigame_ui_garden_button_pressed() -> void:
func _on_minigame_ui_stimulus_button_pressed() -> void:
get_tree().paused = true
minigame_ui.lock()
await minigame_ui.repeat_stimulus_animation(true)
@warning_ignore("redundant_await")
await _play_stimulus()
await minigame_ui.repeat_stimulus_animation(false)
minigame_ui.unlock()
get_tree().paused = false
+11
View File
@@ -27,6 +27,7 @@ const full_lives_icon: = preload("res://assets/minigames/minigame_ui/graphic/lif
# Left panel
@onready var garden_button: TextureButton = %GardenButton
@onready var stimulus_button: TextureButton = %StimulusButton
@onready var stimulus_texture: TextureRect = %StimulusTexture
@onready var pause_button: TextureButton = %PauseButton
@onready var kalulu_button: TextureButton = %KaluluButton
@@ -52,6 +53,8 @@ const full_lives_icon: = preload("res://assets/minigames/minigame_ui/graphic/lif
@onready var lives_container: = %LivesContainer
@onready var model_lives_rect: = %LivesIconsRect
@onready var animation_player: = $AnimationPlayer
# ------------ Lock/Unlock ------------
@@ -212,3 +215,11 @@ func _on_kalulu_speech_ended() -> void:
func _on_back_to_menu_button_pressed() -> void:
back_to_menu_pressed.emit()
func repeat_stimulus_animation(appear: bool) -> void:
if appear:
animation_player.play("repeat_stimulus")
else:
animation_player.play_backwards("repeat_stimulus")
await animation_player.animation_finished
+121 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=31 format=3 uid="uid://weree6bnlt6f"]
[gd_scene load_steps=34 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"]
@@ -31,6 +31,103 @@
[ext_resource type="Texture2D" uid="uid://c3okdxpi317x5" path="res://assets/minigames/monkeys/graphic/gauge_icon_monkey_full.png" id="27_eee4l"]
[ext_resource type="Texture2D" uid="uid://bsmq426v8148w" path="res://assets/minigames/minigame_ui/graphic/button_next_disabled.png" id="27_wdcsn"]
[sub_resource type="Animation" id="Animation_fr0k4"]
resource_name = "repeat_stimulus"
length = 0.5
step = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("MainControl/Interface/StimulusTexture:size")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(250, 386), Vector2(1000, 1000)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("MainControl/Interface/StimulusTexture:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(101, 440), Vector2(814, 325)]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(),
"transitions": PackedFloat32Array(),
"values": []
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("MainControl/Interface/StimulusTexture:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_qwriy"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("MainControl/Interface/StimulusTexture:size")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(250, 386)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("MainControl/Interface/StimulusTexture:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(101, 440)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("MainControl/Interface/StimulusTexture:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_umrx4"]
_data = {
"RESET": SubResource("Animation_qwriy"),
"repeat_stimulus": SubResource("Animation_fr0k4")
}
[node name="MinigameUI" type="CanvasLayer"]
process_mode = 3
script = ExtResource("1_g5fl4")
@@ -54,6 +151,24 @@ grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="StimulusTexture" type="TextureRect" parent="MainControl/Interface"]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 101.0
offset_top = 440.0
offset_right = 351.0
offset_bottom = 826.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("5_d6rvg")
stretch_mode = 5
[node name="LeftMargin" type="MarginContainer" parent="MainControl/Interface"]
custom_minimum_size = Vector2(450, 2.08165e-12)
layout_mode = 1
@@ -432,6 +547,11 @@ unique_name_in_owner = true
visible = false
layout_mode = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_umrx4")
}
[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"]
+1 -1
View File
@@ -117,7 +117,7 @@ func _on_current_progression_changed() -> void:
func _play_stimulus() -> void:
audio_player.stream = Database.get_audio_stream_for_phoneme(stimuli[current_progression].Phoneme)
audio_player.stream = Database.get_audio_stream_for_phoneme(stimuli[current_progression % stimuli.size()].Phoneme)
audio_player.play()
if audio_player.playing:
await audio_player.finished
+6 -3
View File
@@ -65,15 +65,18 @@ func spawn_crab(stimulus: Dictionary) -> void:
func _on_crab_hit(stimulus: Dictionary) -> void:
crab.set_button_active(false)
crab_audio_stream_player.stop_playing()
stimulus_hit.emit(stimulus)
var tween: = create_tween()
tween.tween_property(crab, "position", Vector2(0.0, -200.0), 0.5)
tween.parallel().tween_property(crab, "rotation_degrees", 540.0, 0.5)
await tween.finished
crab.set_button_active(false)
tween = create_tween()
tween.tween_property(crab, "position", Vector2(0.0, 200.0), 0.5)
await tween.finished
if not timer.is_stopped():
timer.start(0.4)
stimulus_hit.emit(stimulus)
crab_audio_stream_player.stop_playing()
crab.queue_free()
crab = null
+1
View File
@@ -16,6 +16,7 @@ var return_value
func resumable_call(callable: Callable) -> void:
assert(not is_completed, "This Coroutine was already used")
_is_started = true
@warning_ignore("redundant_await")
return_value = await callable.call(self)
is_completed = true