Add parakeets minigame

This commit is contained in:
BimDav
2023-03-07 17:44:37 +01:00
parent 2a20917bca
commit 7351ec2c75
41 changed files with 2067 additions and 17 deletions
+10 -4
View File
@@ -71,11 +71,12 @@ func _ready() -> void:
func _initialize() -> void:
_setup_minigame()
_find_stimuli_and_distractions()
_setup_minigame()
if not Engine.is_editor_hint():
await _curtains_and_kalulu()
_start()
@@ -92,8 +93,8 @@ func _find_stimuli_and_distractions() -> void:
return
# Launch the minigame
func _start() -> void:
# Open the curtains and Kalulu explains
func _curtains_and_kalulu() -> void:
opening_curtain.play("open")
await opening_curtain.animation_finished
@@ -101,6 +102,11 @@ func _start() -> void:
await minigame_ui.kalulu_speech_ended
# Launch the minigame
func _start() -> void:
return
# ------------ End ------------
+8 -3
View File
@@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://8awe4usnucyv"]
[ext_resource type="Script" path="res://sources/minigames/base/base_minigame.gd" id="1_jdfsm"]
[ext_resource type="PackedScene" uid="uid://cweny8on01s4o" path="res://sources/minigames/base/minigame_ui.tscn" id="2_a3tib"]
[ext_resource type="PackedScene" path="res://sources/minigames/base/opening_curtain.tscn" id="3_p5ryr"]
[ext_resource type="PackedScene" uid="uid://weree6bnlt6f" path="res://sources/minigames/base/minigame_ui.tscn" id="2_a3tib"]
[ext_resource type="PackedScene" uid="uid://b3ckdfnbc7077" path="res://sources/minigames/base/opening_curtain.tscn" id="3_p5ryr"]
[node name="BaseMinigame" type="Control"]
process_mode = 3
@@ -23,7 +23,12 @@ process_mode = 3
[node name="GameRoot" type="Control" parent="."]
process_mode = 1
anchors_preset = 0
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[connection signal="effects_volume_changed" from="MinigameUI" to="." method="_on_minigame_ui_effects_volume_changed"]
[connection signal="garden_button_pressed" from="MinigameUI" to="." method="_on_minigame_ui_garden_button_pressed"]
+1 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3]
[gd_scene load_steps=16 format=3 uid="uid://bwe3fp0vkpufb"]
[ext_resource type="Script" path="res://sources/minigames/crabs/crab/crab.gd" id="1_5hgg8"]
[ext_resource type="Texture2D" uid="uid://c36217nu30yh3" path="res://assets/minigames/crabs/graphic/crab_spritesheet.png" id="2_yu4q0"]
+1 -1
View File
@@ -68,7 +68,7 @@ func _find_stimuli_and_distractions() -> void:
# Launch the minigame
func _start() -> void:
await super._start()
super._start()
_on_hole_timer_timeout(stimuli[0])
+1 -8
View File
@@ -21,14 +21,6 @@ win_kalulu_speech = ExtResource("4_cikjm")
empty_progression_icon = ExtResource("5_7vlrm")
full_progression_icon = ExtResource("6_1r44u")
[node name="GameRoot" parent="." index="3"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Background" type="TextureRect" parent="GameRoot" index="0"]
layout_mode = 1
anchors_preset = 15
@@ -46,3 +38,4 @@ offset_left = 545.0
offset_top = 629.0
offset_right = 2311.0
offset_bottom = 1673.0
metadata/_edit_lock_ = true
@@ -0,0 +1,342 @@
[gd_resource type="SpriteFrames" load_steps=45 format=3 uid="uid://b0v0hphpt2npg"]
[ext_resource type="Texture2D" uid="uid://xo0vj3ubvidu" path="res://resources/minigames/parakeets/graphic/green_parakeet_spritesheet.png" id="1_knm81"]
[sub_resource type="AtlasTexture" id="AtlasTexture_1o8yh"]
atlas = ExtResource("1_knm81")
region = Rect2(0, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_ik1ok"]
atlas = ExtResource("1_knm81")
region = Rect2(183, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_j2ule"]
atlas = ExtResource("1_knm81")
region = Rect2(366, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_84re5"]
atlas = ExtResource("1_knm81")
region = Rect2(549, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_ri562"]
atlas = ExtResource("1_knm81")
region = Rect2(732, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_l5rbq"]
atlas = ExtResource("1_knm81")
region = Rect2(915, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_bbcw1"]
atlas = ExtResource("1_knm81")
region = Rect2(0, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_pwywc"]
atlas = ExtResource("1_knm81")
region = Rect2(183, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_grig5"]
atlas = ExtResource("1_knm81")
region = Rect2(366, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_smhx0"]
atlas = ExtResource("1_knm81")
region = Rect2(549, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_8mwx0"]
atlas = ExtResource("1_knm81")
region = Rect2(732, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_qbhy6"]
atlas = ExtResource("1_knm81")
region = Rect2(915, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_hrxht"]
atlas = ExtResource("1_knm81")
region = Rect2(1098, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_spw0j"]
atlas = ExtResource("1_knm81")
region = Rect2(1281, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_hw7b3"]
atlas = ExtResource("1_knm81")
region = Rect2(0, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_h86tp"]
atlas = ExtResource("1_knm81")
region = Rect2(183, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_mwi5j"]
atlas = ExtResource("1_knm81")
region = Rect2(366, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_x46ly"]
atlas = ExtResource("1_knm81")
region = Rect2(549, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_a4g04"]
atlas = ExtResource("1_knm81")
region = Rect2(732, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_bu158"]
atlas = ExtResource("1_knm81")
region = Rect2(915, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_kuvg2"]
atlas = ExtResource("1_knm81")
region = Rect2(1098, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_5o7uj"]
atlas = ExtResource("1_knm81")
region = Rect2(1281, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_4ewlg"]
atlas = ExtResource("1_knm81")
region = Rect2(0, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_yaegx"]
atlas = ExtResource("1_knm81")
region = Rect2(183, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_gfu45"]
atlas = ExtResource("1_knm81")
region = Rect2(366, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_8b5ma"]
atlas = ExtResource("1_knm81")
region = Rect2(549, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_77rnf"]
atlas = ExtResource("1_knm81")
region = Rect2(732, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_agcw6"]
atlas = ExtResource("1_knm81")
region = Rect2(915, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_1suva"]
atlas = ExtResource("1_knm81")
region = Rect2(0, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_tlln4"]
atlas = ExtResource("1_knm81")
region = Rect2(183, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_73pja"]
atlas = ExtResource("1_knm81")
region = Rect2(366, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_ckwh1"]
atlas = ExtResource("1_knm81")
region = Rect2(549, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_wlrm0"]
atlas = ExtResource("1_knm81")
region = Rect2(732, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_6cg1y"]
atlas = ExtResource("1_knm81")
region = Rect2(915, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_sjqvw"]
atlas = ExtResource("1_knm81")
region = Rect2(0, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_xru2x"]
atlas = ExtResource("1_knm81")
region = Rect2(183, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_87l4t"]
atlas = ExtResource("1_knm81")
region = Rect2(366, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_kdyei"]
atlas = ExtResource("1_knm81")
region = Rect2(549, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_qcric"]
atlas = ExtResource("1_knm81")
region = Rect2(732, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_7yi4s"]
atlas = ExtResource("1_knm81")
region = Rect2(915, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_e5n7y"]
atlas = ExtResource("1_knm81")
region = Rect2(0, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_vrpko"]
atlas = ExtResource("1_knm81")
region = Rect2(183, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_j4i3f"]
atlas = ExtResource("1_knm81")
region = Rect2(366, 800, 183, 200)
[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_1o8yh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ik1ok")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j2ule")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_84re5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ri562")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l5rbq")
}],
"loop": true,
"name": &"back",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_bbcw1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pwywc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_grig5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_smhx0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8mwx0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qbhy6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_hrxht")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_spw0j")
}],
"loop": true,
"name": &"fly",
"speed": 9.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_hw7b3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_h86tp")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mwi5j")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x46ly")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_a4g04")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bu158")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kuvg2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5o7uj")
}],
"loop": true,
"name": &"happy",
"speed": 9.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_4ewlg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_yaegx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gfu45")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8b5ma")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_77rnf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_agcw6")
}],
"loop": true,
"name": &"idle_front",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_1suva")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tlln4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_73pja")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ckwh1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wlrm0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6cg1y")
}],
"loop": true,
"name": &"idle_front_blink",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_sjqvw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_xru2x")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_87l4t")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kdyei")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qcric")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7yi4s")
}],
"loop": true,
"name": &"sad",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_e5n7y")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vrpko")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j4i3f")
}],
"loop": false,
"name": &"turn_to_back",
"speed": 7.0
}]
+75
View File
@@ -0,0 +1,75 @@
@tool
extends Node2D
const instance_scene: = "res://sources/minigames/parakeets/parakeet.tscn"
signal pressed()
@export var sad_duration: = 2.0
@onready var animated_sprite: = $AnimatedSprite2D
@onready var label: = $Label
var stimulus: Dictionary :
set(value):
stimulus = value
label.text = value.label
const animations: = [
preload("res://sources/minigames/parakeets/red_parakeet_animations.tres"),
preload("res://sources/minigames/parakeets/green_parakeet_animations.tres"),
preload("res://sources/minigames/parakeets/yellow_parakeet_spritesheet.tres")
]
func _ready() -> void:
animated_sprite.sprite_frames = animations[randi() % animations.size()]
func _on_button_pressed() -> void:
pressed.emit()
static func instantiate():
return load(instance_scene).instantiate()
func turn_to_back() -> void:
animated_sprite.play("turn_to_back")
label.hide()
await animated_sprite.animation_finished
animated_sprite.play("back")
func turn_to_front() -> void:
animated_sprite.play_backwards("turn_to_back")
await animated_sprite.animation_finished
label.show()
animated_sprite.play("idle_front")
func _on_animated_sprite_2d_animation_looped() -> void:
if animated_sprite.animation == "idle_front" and randi() % 4 == 0:
animated_sprite.play("idle_front_blink")
func fly_to(target: Vector2, duration: float) -> void:
animated_sprite.play("fly")
var tween: = create_tween()
tween.set_trans(Tween.TRANS_SINE)
tween.set_ease(Tween.EASE_IN_OUT)
tween.tween_property(self, "global_position", target, duration)
await tween.finished
func happy() -> void:
animated_sprite.play("happy")
func idle() -> void:
animated_sprite.play("idle_front")
func sad() -> void:
animated_sprite.play("sad")
await get_tree().create_timer(sad_duration).timeout
+54
View File
@@ -0,0 +1,54 @@
[gd_scene load_steps=10 format=3 uid="uid://cmoeum0oc0p2"]
[ext_resource type="Script" path="res://sources/minigames/parakeets/parakeet.gd" id="1_dc5e0"]
[ext_resource type="SpriteFrames" uid="uid://c4xffrugn6xgx" path="res://sources/minigames/parakeets/yellow_parakeet_spritesheet.tres" id="2_qdecy"]
[ext_resource type="FontFile" uid="uid://b2l4jfylc1v41" path="res://resources/fonts/DidactGothic-Regular.ttf" id="5_k8sc4"]
[sub_resource type="LabelSettings" id="LabelSettings_chx0h"]
font = ExtResource("5_k8sc4")
font_size = 60
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_2q8kg"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_aup5h"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_mmhru"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_b6a1p"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_45x46"]
[node name="Parakeet" type="Node2D"]
script = ExtResource("1_dc5e0")
sad_duration = null
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
scale = Vector2(1.5, 1.5)
sprite_frames = ExtResource("2_qdecy")
animation = &"sad"
autoplay = "idle_front"
offset = Vector2(2.08165e-12, -82)
[node name="Label" type="Label" parent="."]
offset_left = -17.0
offset_top = -108.0
offset_right = 18.0
offset_bottom = -26.0
theme_override_fonts/font = ExtResource("5_k8sc4")
text = "A"
label_settings = SubResource("LabelSettings_chx0h")
horizontal_alignment = 1
[node name="Button" type="Button" parent="."]
offset_left = -91.0
offset_top = -255.0
offset_right = 90.0
offset_bottom = 13.0
theme_override_styles/normal = SubResource("StyleBoxEmpty_2q8kg")
theme_override_styles/hover = SubResource("StyleBoxEmpty_aup5h")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_mmhru")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_b6a1p")
theme_override_styles/focus = SubResource("StyleBoxEmpty_45x46")
[connection signal="animation_looped" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_looped"]
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
@@ -0,0 +1,225 @@
extends Minigame
const Parakeet: = preload("res://sources/minigames/parakeets/parakeet.gd")
enum State {
Locked,
Idle,
Selected1,
Selected2,
}
enum Audio {
Fly,
Happy,
Turn,
Win,
}
const audio_streams: = [
preload("res://resources/minigames/parakeets/audio/parakeet_fly.mp3"),
preload("res://resources/minigames/parakeets/audio/parakeet_happy_short.mp3"),
preload("res://resources/minigames/parakeets/audio/parakeet_turn_over.mp3"),
preload("res://resources/minigames/parakeets/audio/parakeet_win.mp3"),
]
@export var difficulty: = 1
@export var fly_duration: = 3.0
@onready var possible_positions_parent: = $GameRoot/PossiblePositions
@onready var parakeets_node: = $GameRoot/Parakeets
@onready var nest_positions: Array[Vector2] = [$GameRoot/TreeNestFront/Position1.global_position, $GameRoot/TreeNestFront/Position2.global_position]
@onready var fly_away_positions: Array[Vector2] = [$GameRoot/FlyAway/Position1.global_position, $GameRoot/FlyAway/Position2.global_position]
@onready var audio_player: = $AudioStreamPlayer
var parakeets: Array[Parakeet]
var selected: Array[Parakeet]
var state: = State.Locked
var correct_count: = 0
const difficulty_settings: = {
0 : {"pairs_count": 2},
1 : {"pairs_count": 3},
2 : {"pairs_count": 4},
3 : {"pairs_count": 5},
4 : {"pairs_count": 6},
}
# Find and set the parameters of the minigame, like the number of lives or the victory conditions.
func _setup_minigame() -> void:
super._setup_minigame()
# Progression management
current_progression = 0
var max_difficulty: = 0
for d in difficulty_settings.keys():
if d > max_difficulty:
max_difficulty = d
if difficulty > max_difficulty:
difficulty = max_difficulty
var settings: Dictionary = difficulty_settings[difficulty]
var pairs_count: int = settings.pairs_count
var possible_positions: = possible_positions_parent.get_children()
possible_positions.shuffle()
var stimuli2: = stimuli.duplicate()
stimuli2.shuffle()
for i in pairs_count:
var new_parakeet1: Parakeet = Parakeet.instantiate()
var new_parakeet2: Parakeet = Parakeet.instantiate()
parakeets_node.add_child(new_parakeet1)
parakeets_node.add_child(new_parakeet2)
new_parakeet1.position = possible_positions[2 * i].position
new_parakeet2.position = possible_positions[2 * i + 1].position
parakeets.append_array([new_parakeet1, new_parakeet2])
var stimulus: Dictionary = stimuli2.pop_back()
var stimulus_up: = stimulus.duplicate()
stimulus_up.label = stimulus_up.label.to_upper()
new_parakeet1.stimulus = stimulus
new_parakeet2.stimulus = stimulus_up
new_parakeet1.pressed.connect(_on_parakeet_pressed.bind(new_parakeet1))
new_parakeet2.pressed.connect(_on_parakeet_pressed.bind(new_parakeet2))
# Find the stimuli and distractions of the minigame.
func _find_stimuli_and_distractions() -> void:
# TODO: fake stimuli and distractor for testing
# Replace in the future by a proper research
stimuli = [
{"label": "a", "sound": ""},
{"label": "b", "sound": ""},
{"label": "c", "sound": ""},
]
func _start() -> void:
_present_parakeets()
func _on_parakeet_pressed(parakeet: Parakeet) -> void:
match state:
State.Selected2, State.Locked:
return
State.Selected1:
state = State.Locked
if parakeet in selected:
selected.erase(parakeet)
await _turn(parakeet, true)
state = State.Idle
else:
selected.append(parakeet)
await _turn(parakeet, false)
state = State.Selected2
_on_selected_two()
State.Idle:
state = State.Locked
selected.append(parakeet)
await _turn(parakeet, false)
state = State.Selected1
func _on_selected_two() -> void:
if selected[0].stimulus.label.to_upper() == selected[1].stimulus.label.to_upper():
_correct()
else:
_wrong()
func _correct() -> void:
if selected[0].global_position.x > selected[1].global_position.x:
var buffer: = selected[0]
selected[0] = selected[1]
selected[1] = buffer
await _make_selected_happy()
await _fly_to(nest_positions)
await _make_selected_coo()
await _fly_to(fly_away_positions)
correct_count += 1
if correct_count * 2 >= parakeets.size():
_win()
else:
state = State.Idle
selected.clear()
func _wrong() -> void:
await _make_selected_sad()
for parakeet in selected:
parakeet.idle()
await _parakeets_to_front(selected)
await _present_parakeets()
selected.clear()
func _parakeets_to_front(exceptions: Array[Parakeet] = []) -> void:
var coroutine: = Coroutine.new()
for parakeet in parakeets:
if parakeet in exceptions:
continue
coroutine.add_future(_turn.bind(parakeet, false))
await coroutine.join()
func _present_parakeets() -> void:
await get_tree().create_timer(3).timeout
var coroutine: = Coroutine.new()
for parakeet in parakeets:
coroutine.add_future(_turn.bind(parakeet, true))
await coroutine.join()
state = State.Idle
func _make_selected_happy() -> void:
for parakeet in selected:
parakeet.happy()
audio_player.stream = audio_streams[Audio.Happy]
audio_player.play()
await audio_player.finished
func _make_selected_sad() -> void:
var coroutine: = Coroutine.new()
for parakeet in selected:
coroutine.add_future(parakeet.sad)
await coroutine.join()
func _make_selected_coo() -> void:
for parakeet in selected:
parakeet.idle()
audio_player.stream = audio_streams[Audio.Win]
audio_player.play()
await audio_player.finished
func _fly_to(targets: Array[Vector2]) -> void:
var coroutine: = Coroutine.new()
audio_player.stream = audio_streams[Audio.Fly]
audio_player.play()
coroutine.add_future(audio_player.finished)
coroutine.add_future(selected[0].fly_to.bind(targets[0], fly_duration))
coroutine.add_future(selected[1].fly_to.bind(targets[1], fly_duration))
await coroutine.join()
func _turn(parakeet: Parakeet, to_back: bool) -> void:
audio_player.stream = audio_streams[Audio.Turn]
audio_player.play()
if to_back:
await parakeet.turn_to_back()
else:
await parakeet.turn_to_front()
@@ -0,0 +1,235 @@
[gd_scene load_steps=10 format=3 uid="uid://r6isdmxuqpvg"]
[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"]
[ext_resource type="AudioStream" uid="uid://csbrl2rxli4tp" path="res://resources/minigames/parakeets/audio/kalulu_intro_parakeets_language.mp3" id="3_ofxb4"]
[ext_resource type="Texture2D" uid="uid://dv1ombj8eolb1" path="res://resources/minigames/parakeets/graphic/background.png" id="3_xjvte"]
[ext_resource type="AudioStream" uid="uid://c58a2q8b26vpn" path="res://resources/minigames/parakeets/audio/kalulu_end_parakeets_language.mp3" id="4_01e28"]
[ext_resource type="Texture2D" uid="uid://clvh07xfgjmri" path="res://resources/minigames/parakeets/graphic/tree_trunk.png" id="4_unuga"]
[ext_resource type="Texture2D" uid="uid://d3n327me83on7" path="res://resources/minigames/parakeets/graphic/tree_branch.png" id="5_46kss"]
[ext_resource type="Texture2D" uid="uid://sjxhvbq8ijbw" path="res://resources/minigames/parakeets/graphic/nest_back.png" id="6_g64mq"]
[ext_resource type="Texture2D" uid="uid://ctvnu3s3sgwwf" path="res://resources/minigames/parakeets/graphic/nest_front.png" id="7_3mibn"]
[node name="Parakeets" instance=ExtResource("1_oeg4r")]
script = ExtResource("2_x6xn5")
difficulty = 1
fly_duration = 3.0
help_kalulu_speech = ExtResource("3_ofxb4")
win_kalulu_speech = ExtResource("4_01e28")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="." index="3"]
[node name="Background" type="TextureRect" parent="GameRoot" index="0"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_xjvte")
[node name="TreeTrunk" type="TextureRect" parent="GameRoot" index="1"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -46.0
offset_top = -900.0
offset_right = 46.0
offset_bottom = 900.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("4_unuga")
[node name="TreeBranch" type="TextureRect" parent="GameRoot" index="2"]
layout_mode = 0
offset_left = 438.0
offset_top = 597.0
offset_right = 1262.0
offset_bottom = 637.0
texture = ExtResource("5_46kss")
[node name="TreeBranch2" type="TextureRect" parent="GameRoot" index="3"]
layout_mode = 0
offset_left = 1312.0
offset_top = 431.0
offset_right = 2187.0
offset_bottom = 471.0
texture = ExtResource("5_46kss")
[node name="TreeBranch3" type="TextureRect" parent="GameRoot" index="4"]
layout_mode = 0
offset_left = 1299.0
offset_top = 818.0
offset_right = 2283.0
offset_bottom = 858.0
texture = ExtResource("5_46kss")
[node name="TreeBranch4" type="TextureRect" parent="GameRoot" index="5"]
layout_mode = 0
offset_left = 498.0
offset_top = 1145.0
offset_right = 1307.0
offset_bottom = 1185.0
texture = ExtResource("5_46kss")
[node name="TreeBranch5" type="TextureRect" parent="GameRoot" index="6"]
layout_mode = 0
offset_left = 1289.0
offset_top = 1502.0
offset_right = 2040.0
offset_bottom = 1542.0
texture = ExtResource("5_46kss")
[node name="TreeNestBack" type="TextureRect" parent="GameRoot" index="7"]
visible = false
layout_mode = 0
offset_left = 1557.0
offset_top = 1405.0
offset_right = 1847.0
offset_bottom = 1512.0
texture = ExtResource("6_g64mq")
[node name="PossiblePositions" type="Control" parent="GameRoot" index="8"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Control" type="Control" parent="GameRoot/PossiblePositions" index="0"]
anchors_preset = 0
offset_left = 547.0
offset_top = 598.0
offset_right = 587.0
offset_bottom = 638.0
[node name="Control2" type="Control" parent="GameRoot/PossiblePositions" index="1"]
anchors_preset = 0
offset_left = 828.0
offset_top = 598.0
offset_right = 868.0
offset_bottom = 638.0
[node name="Control3" type="Control" parent="GameRoot/PossiblePositions" index="2"]
anchors_preset = 0
offset_left = 1096.0
offset_top = 598.0
offset_right = 1136.0
offset_bottom = 638.0
[node name="Control4" type="Control" parent="GameRoot/PossiblePositions" index="3"]
anchors_preset = 0
offset_left = 1515.0
offset_top = 431.0
offset_right = 1604.0
offset_bottom = 452.0
[node name="Control5" type="Control" parent="GameRoot/PossiblePositions" index="4"]
anchors_preset = 0
offset_left = 1829.0
offset_top = 431.0
offset_right = 1869.0
offset_bottom = 471.0
[node name="Control6" type="Control" parent="GameRoot/PossiblePositions" index="5"]
anchors_preset = 0
offset_left = 2106.0
offset_top = 431.0
offset_right = 2146.0
offset_bottom = 431.0
[node name="Control7" type="Control" parent="GameRoot/PossiblePositions" index="6"]
anchors_preset = 0
offset_left = 1429.0
offset_top = 818.0
offset_right = 1469.0
offset_bottom = 858.0
[node name="Control8" type="Control" parent="GameRoot/PossiblePositions" index="7"]
anchors_preset = 0
offset_left = 1719.0
offset_top = 818.0
offset_right = 1759.0
offset_bottom = 858.0
[node name="Control9" type="Control" parent="GameRoot/PossiblePositions" index="8"]
anchors_preset = 0
offset_left = 1988.0
offset_top = 818.0
offset_right = 2028.0
offset_bottom = 858.0
[node name="Control10" type="Control" parent="GameRoot/PossiblePositions" index="9"]
anchors_preset = 0
offset_left = 2201.0
offset_top = 818.0
offset_right = 2241.0
offset_bottom = 858.0
[node name="Control11" type="Control" parent="GameRoot/PossiblePositions" index="10"]
anchors_preset = 0
offset_left = 661.0
offset_top = 1145.0
offset_right = 701.0
offset_bottom = 1185.0
[node name="Control12" type="Control" parent="GameRoot/PossiblePositions" index="11"]
anchors_preset = 0
offset_left = 1012.0
offset_top = 1145.0
offset_right = 1052.0
offset_bottom = 1185.0
[node name="Parakeets" type="Control" parent="GameRoot" index="9"]
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="TreeNestFront" type="TextureRect" parent="GameRoot" index="10"]
layout_mode = 0
offset_left = 1557.0
offset_top = 1405.0
offset_right = 1847.0
offset_bottom = 1512.0
texture = ExtResource("7_3mibn")
[node name="Position1" type="Control" parent="GameRoot/TreeNestFront" index="0"]
anchors_preset = 0
offset_left = 109.0
offset_top = 42.0
offset_right = 149.0
offset_bottom = 82.0
[node name="Position2" type="Control" parent="GameRoot/TreeNestFront" index="1"]
anchors_preset = 0
offset_left = 186.0
offset_top = 43.0
offset_right = 226.0
offset_bottom = 83.0
[node name="FlyAway" type="Control" parent="GameRoot" index="11"]
anchors_preset = 0
offset_left = 2832.0
offset_top = 1157.0
offset_right = 2872.0
offset_bottom = 1197.0
[node name="Position1" type="Control" parent="GameRoot/FlyAway" index="0"]
layout_mode = 3
anchors_preset = 0
offset_left = 109.0
offset_top = 42.0
offset_right = 149.0
offset_bottom = 82.0
[node name="Position2" type="Control" parent="GameRoot/FlyAway" index="1"]
layout_mode = 3
anchors_preset = 0
offset_left = 186.0
offset_top = 43.0
offset_right = 226.0
offset_bottom = 83.0
@@ -0,0 +1,335 @@
[gd_resource type="SpriteFrames" load_steps=44 format=3 uid="uid://wybpq21deku7"]
[ext_resource type="Texture2D" uid="uid://ct4ags1dnh17v" path="res://resources/minigames/parakeets/graphic/red_parakeet_spritesheet.png" id="1_xu2lq"]
[sub_resource type="AtlasTexture" id="AtlasTexture_2m73y"]
atlas = ExtResource("1_xu2lq")
region = Rect2(0, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_6aofb"]
atlas = ExtResource("1_xu2lq")
region = Rect2(183, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_t41im"]
atlas = ExtResource("1_xu2lq")
region = Rect2(366, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_r4sl4"]
atlas = ExtResource("1_xu2lq")
region = Rect2(549, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_uu1ct"]
atlas = ExtResource("1_xu2lq")
region = Rect2(732, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_x2gj2"]
atlas = ExtResource("1_xu2lq")
region = Rect2(915, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_q0nc0"]
atlas = ExtResource("1_xu2lq")
region = Rect2(0, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_coog2"]
atlas = ExtResource("1_xu2lq")
region = Rect2(183, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_k0fdy"]
atlas = ExtResource("1_xu2lq")
region = Rect2(366, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_uqmyo"]
atlas = ExtResource("1_xu2lq")
region = Rect2(549, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_x0gpd"]
atlas = ExtResource("1_xu2lq")
region = Rect2(732, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_qs5t4"]
atlas = ExtResource("1_xu2lq")
region = Rect2(915, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_sohoh"]
atlas = ExtResource("1_xu2lq")
region = Rect2(1098, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_483bb"]
atlas = ExtResource("1_xu2lq")
region = Rect2(1281, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_toyts"]
atlas = ExtResource("1_xu2lq")
region = Rect2(0, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_3uulo"]
atlas = ExtResource("1_xu2lq")
region = Rect2(183, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_snh56"]
atlas = ExtResource("1_xu2lq")
region = Rect2(366, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_u4ekp"]
atlas = ExtResource("1_xu2lq")
region = Rect2(549, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_o3n4q"]
atlas = ExtResource("1_xu2lq")
region = Rect2(732, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_v8oy0"]
atlas = ExtResource("1_xu2lq")
region = Rect2(915, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_67r72"]
atlas = ExtResource("1_xu2lq")
region = Rect2(1098, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_whqew"]
atlas = ExtResource("1_xu2lq")
region = Rect2(1281, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_rjx4f"]
atlas = ExtResource("1_xu2lq")
region = Rect2(0, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_p502j"]
atlas = ExtResource("1_xu2lq")
region = Rect2(183, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_r3n82"]
atlas = ExtResource("1_xu2lq")
region = Rect2(366, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_sc4pk"]
atlas = ExtResource("1_xu2lq")
region = Rect2(549, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_yb7ml"]
atlas = ExtResource("1_xu2lq")
region = Rect2(732, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_4vdgs"]
atlas = ExtResource("1_xu2lq")
region = Rect2(915, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_cw3uc"]
atlas = ExtResource("1_xu2lq")
region = Rect2(0, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_tmufa"]
atlas = ExtResource("1_xu2lq")
region = Rect2(183, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_181oc"]
atlas = ExtResource("1_xu2lq")
region = Rect2(366, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_kw27o"]
atlas = ExtResource("1_xu2lq")
region = Rect2(549, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_1rjtv"]
atlas = ExtResource("1_xu2lq")
region = Rect2(732, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_qy8ia"]
atlas = ExtResource("1_xu2lq")
region = Rect2(915, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_iuwep"]
atlas = ExtResource("1_xu2lq")
region = Rect2(183, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_54c8j"]
atlas = ExtResource("1_xu2lq")
region = Rect2(366, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_7xked"]
atlas = ExtResource("1_xu2lq")
region = Rect2(549, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_sqk5t"]
atlas = ExtResource("1_xu2lq")
region = Rect2(732, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_bms7v"]
atlas = ExtResource("1_xu2lq")
region = Rect2(915, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_lap0l"]
atlas = ExtResource("1_xu2lq")
region = Rect2(0, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_qdrtm"]
atlas = ExtResource("1_xu2lq")
region = Rect2(183, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_ja80d"]
atlas = ExtResource("1_xu2lq")
region = Rect2(366, 1200, 183, 200)
[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_2m73y")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6aofb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_t41im")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_r4sl4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_uu1ct")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x2gj2")
}],
"loop": true,
"name": &"back",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_q0nc0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_coog2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_k0fdy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_uqmyo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x0gpd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qs5t4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sohoh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_483bb")
}],
"loop": true,
"name": &"fly",
"speed": 9.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_toyts")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3uulo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_snh56")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_u4ekp")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_o3n4q")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_v8oy0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_67r72")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_whqew")
}],
"loop": true,
"name": &"happy",
"speed": 9.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_rjx4f")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_p502j")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_r3n82")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sc4pk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_yb7ml")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4vdgs")
}],
"loop": true,
"name": &"idle_front",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_cw3uc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tmufa")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_181oc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kw27o")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1rjtv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qy8ia")
}],
"loop": true,
"name": &"idle_front_blink",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_iuwep")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_54c8j")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7xked")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sqk5t")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bms7v")
}],
"loop": true,
"name": &"sad",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_lap0l")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qdrtm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ja80d")
}],
"loop": false,
"name": &"turn_to_back",
"speed": 7.0
}]
@@ -0,0 +1,342 @@
[gd_resource type="SpriteFrames" load_steps=45 format=3 uid="uid://c4xffrugn6xgx"]
[ext_resource type="Texture2D" uid="uid://dd37d3qdrfrt0" path="res://resources/minigames/parakeets/graphic/yellow_parakeet_spritesheet.png" id="1_5275a"]
[sub_resource type="AtlasTexture" id="AtlasTexture_ggw2c"]
atlas = ExtResource("1_5275a")
region = Rect2(0, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_b6j6r"]
atlas = ExtResource("1_5275a")
region = Rect2(183, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_ql11h"]
atlas = ExtResource("1_5275a")
region = Rect2(366, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_4dki4"]
atlas = ExtResource("1_5275a")
region = Rect2(549, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_5egcb"]
atlas = ExtResource("1_5275a")
region = Rect2(732, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_6j8cb"]
atlas = ExtResource("1_5275a")
region = Rect2(915, 0, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_wugc2"]
atlas = ExtResource("1_5275a")
region = Rect2(0, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_eq6q0"]
atlas = ExtResource("1_5275a")
region = Rect2(183, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_6mjya"]
atlas = ExtResource("1_5275a")
region = Rect2(366, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_1t23v"]
atlas = ExtResource("1_5275a")
region = Rect2(549, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_0fn7h"]
atlas = ExtResource("1_5275a")
region = Rect2(732, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_wfym8"]
atlas = ExtResource("1_5275a")
region = Rect2(915, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_xuw8f"]
atlas = ExtResource("1_5275a")
region = Rect2(1098, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_p01iw"]
atlas = ExtResource("1_5275a")
region = Rect2(1281, 200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_ptkab"]
atlas = ExtResource("1_5275a")
region = Rect2(0, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_i87ff"]
atlas = ExtResource("1_5275a")
region = Rect2(183, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_ppljj"]
atlas = ExtResource("1_5275a")
region = Rect2(366, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_t1n2m"]
atlas = ExtResource("1_5275a")
region = Rect2(549, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_ckvw0"]
atlas = ExtResource("1_5275a")
region = Rect2(732, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_nrb2y"]
atlas = ExtResource("1_5275a")
region = Rect2(915, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_33jdu"]
atlas = ExtResource("1_5275a")
region = Rect2(1098, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_x64e8"]
atlas = ExtResource("1_5275a")
region = Rect2(1281, 400, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_5108u"]
atlas = ExtResource("1_5275a")
region = Rect2(0, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_l0uis"]
atlas = ExtResource("1_5275a")
region = Rect2(183, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_1225x"]
atlas = ExtResource("1_5275a")
region = Rect2(366, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_vq2xs"]
atlas = ExtResource("1_5275a")
region = Rect2(549, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_or31j"]
atlas = ExtResource("1_5275a")
region = Rect2(732, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_dxgtc"]
atlas = ExtResource("1_5275a")
region = Rect2(915, 600, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_p0tr7"]
atlas = ExtResource("1_5275a")
region = Rect2(0, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_gk0ar"]
atlas = ExtResource("1_5275a")
region = Rect2(183, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_8usp1"]
atlas = ExtResource("1_5275a")
region = Rect2(366, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_rs48g"]
atlas = ExtResource("1_5275a")
region = Rect2(549, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_woo6n"]
atlas = ExtResource("1_5275a")
region = Rect2(732, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_ymqjw"]
atlas = ExtResource("1_5275a")
region = Rect2(915, 800, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_aa6e7"]
atlas = ExtResource("1_5275a")
region = Rect2(0, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_5tjla"]
atlas = ExtResource("1_5275a")
region = Rect2(183, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_pd32m"]
atlas = ExtResource("1_5275a")
region = Rect2(366, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_rr0l3"]
atlas = ExtResource("1_5275a")
region = Rect2(549, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_vrsnq"]
atlas = ExtResource("1_5275a")
region = Rect2(732, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_02ixo"]
atlas = ExtResource("1_5275a")
region = Rect2(915, 1000, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_7b5dw"]
atlas = ExtResource("1_5275a")
region = Rect2(0, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_4p0n3"]
atlas = ExtResource("1_5275a")
region = Rect2(183, 1200, 183, 200)
[sub_resource type="AtlasTexture" id="AtlasTexture_rtbfy"]
atlas = ExtResource("1_5275a")
region = Rect2(366, 1200, 183, 200)
[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ggw2c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_b6j6r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ql11h")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4dki4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5egcb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6j8cb")
}],
"loop": true,
"name": &"back",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_wugc2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_eq6q0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6mjya")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1t23v")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0fn7h")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wfym8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_xuw8f")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_p01iw")
}],
"loop": true,
"name": &"fly",
"speed": 9.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ptkab")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_i87ff")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ppljj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_t1n2m")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ckvw0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_nrb2y")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_33jdu")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x64e8")
}],
"loop": true,
"name": &"happy",
"speed": 9.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_5108u")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l0uis")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1225x")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vq2xs")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_or31j")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dxgtc")
}],
"loop": true,
"name": &"idle_front",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_p0tr7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gk0ar")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8usp1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rs48g")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_woo6n")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ymqjw")
}],
"loop": true,
"name": &"idle_front_blink",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_aa6e7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5tjla")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pd32m")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rr0l3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vrsnq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_02ixo")
}],
"loop": true,
"name": &"sad",
"speed": 7.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_7b5dw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4p0n3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rtbfy")
}],
"loop": false,
"name": &"turn_to_back",
"speed": 7.0
}]
+52
View File
@@ -0,0 +1,52 @@
extends RefCounted
class_name Coroutine
# For resume functionality
signal resume_signal()
var _is_started: = false
var is_completed: = false
# For join functionality
signal _join()
var _futures_count: = -1
var return_value
func resumable_call(callable: Callable) -> void:
assert(not is_completed, "This Coroutine was already used")
_is_started = true
return_value = await callable.call(self)
is_completed = true
func resume() -> void:
assert(_is_started, "Trying to resume a Coroutine that was not started")
resume_signal.emit()
func add_future(param) -> void:
assert(param is Callable or param is Signal, "Can only wait on Signal or Callable")
# init
if _futures_count < 0:
_futures_count = 0
return_value = []
var index: int = return_value.size()
return_value.append(null)
_futures_count += 1
if param is Callable:
return_value[index] = await param.call()
else:
await param
_futures_count -= 1
if _futures_count == 0:
_join.emit()
func join() -> Array:
if _futures_count <= 0:
return return_value
await _join
return return_value