Monkeys animated logic in place
This commit is contained in:
@@ -6,4 +6,5 @@ extends Node2D
|
||||
var text: String :
|
||||
set(value):
|
||||
text = value
|
||||
label.text = text
|
||||
if label:
|
||||
label.text = text
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
extends Node2D
|
||||
|
||||
@onready var animation_player: = $AnimationPlayer
|
||||
@onready var coconut: = $Marker2D/Coconut
|
||||
@onready var catch_position: = $CatchPosition
|
||||
|
||||
|
||||
func catch(p_coconut: Node2D):
|
||||
p_coconut.hide()
|
||||
coconut.text = p_coconut.text
|
||||
animation_player.play("catch")
|
||||
await animation_player.animation_finished
|
||||
animation_player.play("idle")
|
||||
|
||||
|
||||
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
||||
if anim_name == "idle":
|
||||
if randf() < 0.25:
|
||||
animation_player.play("idle_blink")
|
||||
else:
|
||||
animation_player.play("idle")
|
||||
elif anim_name == "idle_blink":
|
||||
animation_player.play("idle")
|
||||
|
||||
|
||||
func start_right() -> void:
|
||||
animation_player.play("start_right")
|
||||
await animation_player.animation_finished
|
||||
|
||||
|
||||
func finish_right() -> void:
|
||||
animation_player.play("finish_right")
|
||||
await animation_player.animation_finished
|
||||
animation_player.play("idle")
|
||||
|
||||
|
||||
func start_wrong() -> void:
|
||||
animation_player.play("start_wrong")
|
||||
await animation_player.animation_finished
|
||||
|
||||
|
||||
func finish_wrong() -> void:
|
||||
animation_player.play("finish_wrong")
|
||||
await animation_player.animation_finished
|
||||
animation_player.play("idle")
|
||||
|
||||
|
||||
func read() -> void:
|
||||
animation_player.play("read")
|
||||
await animation_player.animation_finished
|
||||
@@ -1,296 +1,416 @@
|
||||
[gd_scene load_steps=38 format=3 uid="uid://b8r26vroslasj"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://b8r26vroslasj"]
|
||||
|
||||
[ext_resource type="Script" path="res://sources/minigames/monkeys/king_monkey.gd" id="1_6p7n7"]
|
||||
[ext_resource type="Texture2D" uid="uid://boxmlmbplr12i" path="res://assets/minigames/monkeys/graphic/king_spritesheet.png" id="1_l8txe"]
|
||||
[ext_resource type="PackedScene" uid="uid://2mwfjg3c68p1" path="res://sources/minigames/monkeys/coconut.tscn" id="3_dsell"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_61ga5"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(0, 0, 240, 221)
|
||||
[sub_resource type="Animation" id="Animation_yp7w5"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(156, -126)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [-0.174533]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Marker2D:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_psyih"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(240, 0, 240, 221)
|
||||
[sub_resource type="Animation" id="Animation_5ospq"]
|
||||
resource_name = "catch"
|
||||
length = 0.375012
|
||||
step = 0.125
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [1, 2, 3, 0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(156, -126), Vector2(49, -80), Vector2(-197, -165), Vector2(-176, -129)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.25, 0.375),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [-0.174533, 0.0, 0.0]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Marker2D:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5er35"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(480, 0, 240, 221)
|
||||
[sub_resource type="Animation" id="Animation_eb4ap"]
|
||||
resource_name = "finish_right"
|
||||
length = 0.500013
|
||||
step = 0.125
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [17, 18, 19, 20]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_luq25"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(720, 0, 240, 221)
|
||||
[sub_resource type="Animation" id="Animation_qtise"]
|
||||
resource_name = "finish_wrong"
|
||||
length = 0.375012
|
||||
step = 0.125
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [10, 11, 12]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(),
|
||||
"transitions": PackedFloat32Array(),
|
||||
"update": 0,
|
||||
"values": []
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(),
|
||||
"transitions": PackedFloat32Array(),
|
||||
"update": 0,
|
||||
"values": []
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Marker2D:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dnce3"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(0, 663, 240, 221)
|
||||
[sub_resource type="Animation" id="Animation_ko53b"]
|
||||
resource_name = "idle"
|
||||
length = 0.857157
|
||||
loop_mode = 1
|
||||
step = 0.142857
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.142857, 0.285714, 0.428571, 0.571429, 0.714286),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [21, 22, 23, 24, 25, 26]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.285714, 0.428571, 0.714286),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-176, -129), Vector2(-175, -99), Vector2(-175, -99), Vector2(-176, -129)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.285714, 0.428571, 0.714286),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, -0.0837758, -0.0837758, 0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nklip"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(240, 663, 240, 221)
|
||||
[sub_resource type="Animation" id="Animation_bat0b"]
|
||||
resource_name = "idle_blink"
|
||||
length = 0.857157
|
||||
loop_mode = 1
|
||||
step = 0.142857
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.142857, 0.285714, 0.428571, 0.571429, 0.714286),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [28, 29, 30, 31, 32, 33]
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4fxv0"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(480, 663, 240, 221)
|
||||
[sub_resource type="Animation" id="Animation_5r5mg"]
|
||||
resource_name = "read"
|
||||
length = 1.00001
|
||||
step = 0.142857
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.142857, 0.285714, 0.428571, 0.571429, 0.714286, 0.857143),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [35, 36, 37, 38, 39, 40, 36]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.285714, 0.571429, 1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-189, -156), Vector2(-166, -165), Vector2(-166, -165), Vector2(-189, -156)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.285714, 0.571429, 1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, -0.493928, -0.493928, 0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_w0q21"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(720, 663, 240, 221)
|
||||
[sub_resource type="Animation" id="Animation_t25c3"]
|
||||
resource_name = "start_right"
|
||||
length = 0.375012
|
||||
step = 0.125
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [14, 15, 16, 17, 18, 19, 20]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-176, -129), Vector2(-1, -21), Vector2(0, 45)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xqhx3"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(960, 663, 240, 221)
|
||||
[sub_resource type="Animation" id="Animation_moet5"]
|
||||
resource_name = "start_wrong"
|
||||
length = 0.375012
|
||||
step = 0.125
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375, 0.5, 0.625),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [7, 8, 9, 10, 11, 12]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-230, -134), Vector2(-153, -265), Vector2(114, -216)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.25),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [-0.0698132, 0.174533]
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qcdea"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(1200, 663, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_t7nj3"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(0, 884, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_iuthd"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(240, 884, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_12sr7"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(480, 884, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xjxvo"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(720, 884, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jb1ly"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(960, 884, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_06cqm"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(1200, 884, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ebv4a"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(0, 1105, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dl12t"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(240, 1105, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_u6pif"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(480, 1105, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_e5k8v"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(720, 1105, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j0v1k"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(960, 1105, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lwrmq"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(1200, 1105, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gyis7"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(1440, 1105, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ilp1g"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(0, 442, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_usu48"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(240, 442, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_54mkd"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(480, 442, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_uhqj6"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(720, 442, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_51v3c"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(960, 442, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0xk7i"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(1200, 442, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qyjhi"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(0, 221, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_aupla"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(240, 221, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_q8d8l"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(480, 221, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_uo0xs"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(720, 221, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_k8vhj"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(960, 221, 240, 221)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_r5alq"]
|
||||
atlas = ExtResource("1_l8txe")
|
||||
region = Rect2(1200, 221, 240, 221)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_jgg6t"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_61ga5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_psyih")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_5er35")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_luq25")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"catch",
|
||||
"speed": 8.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dnce3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_nklip")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4fxv0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_w0q21")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xqhx3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qcdea")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 7.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_t7nj3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_iuthd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_12sr7")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_xjxvo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jb1ly")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_06cqm")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle_blink",
|
||||
"speed": 7.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ebv4a")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dl12t")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_u6pif")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_e5k8v")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j0v1k")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_lwrmq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gyis7")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"read",
|
||||
"speed": 7.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ilp1g")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_usu48")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_54mkd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_uhqj6")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_51v3c")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_0xk7i")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_usu48")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ilp1g")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"right",
|
||||
"speed": 8.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qyjhi")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_aupla")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_q8d8l")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_uo0xs")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_k8vhj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_r5alq")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"wrong",
|
||||
"speed": 8.0
|
||||
}]
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_m40ug"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_yp7w5"),
|
||||
"catch": SubResource("Animation_5ospq"),
|
||||
"finish_right": SubResource("Animation_eb4ap"),
|
||||
"finish_wrong": SubResource("Animation_qtise"),
|
||||
"idle": SubResource("Animation_ko53b"),
|
||||
"idle_blink": SubResource("Animation_bat0b"),
|
||||
"read": SubResource("Animation_5r5mg"),
|
||||
"start_right": SubResource("Animation_t25c3"),
|
||||
"start_wrong": SubResource("Animation_moet5")
|
||||
}
|
||||
|
||||
[node name="KingMonkey" type="Node2D"]
|
||||
script = ExtResource("1_6p7n7")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
scale = Vector2(2, 2)
|
||||
sprite_frames = SubResource("SpriteFrames_jgg6t")
|
||||
animation = &"wrong"
|
||||
autoplay = "idle"
|
||||
texture = ExtResource("1_l8txe")
|
||||
offset = Vector2(-12, -74)
|
||||
hframes = 7
|
||||
vframes = 6
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(156, -126)
|
||||
rotation = -0.174533
|
||||
|
||||
[node name="Coconut" parent="Marker2D" instance=ExtResource("3_dsell")]
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
autoplay = "idle"
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_m40ug")
|
||||
}
|
||||
|
||||
[node name="CatchPosition" type="Marker2D" parent="."]
|
||||
position = Vector2(156, -126)
|
||||
rotation = -0.174533
|
||||
|
||||
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_player_animation_finished"]
|
||||
|
||||
@@ -3,7 +3,7 @@ extends Node2D
|
||||
|
||||
signal pressed()
|
||||
signal dragged_into_self()
|
||||
signal dragged_into(vector)
|
||||
signal dragged_into(vector, monkey)
|
||||
|
||||
const instance_scene: = "res://sources/minigames/monkeys/monkey.tscn"
|
||||
|
||||
@@ -12,6 +12,15 @@ const instance_scene: = "res://sources/minigames/monkeys/monkey.tscn"
|
||||
@onready var drag_preview_label: = $Button/DragPreview/Label
|
||||
@onready var drag_preview: = $Button/DragPreview
|
||||
@onready var button: = $Button
|
||||
@onready var hit_position: = $HitPosition
|
||||
|
||||
var locked: = true:
|
||||
set(value):
|
||||
locked = value or stunned
|
||||
var stunned: = false:
|
||||
set(value):
|
||||
stunned = value
|
||||
locked = true
|
||||
|
||||
|
||||
var stimulus: Dictionary :
|
||||
@@ -30,6 +39,9 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
if locked:
|
||||
return
|
||||
|
||||
pressed.emit()
|
||||
|
||||
|
||||
@@ -41,6 +53,31 @@ func talk() -> void:
|
||||
animation_player.play("idle")
|
||||
|
||||
|
||||
func grab() -> void:
|
||||
animation_player.play("grab")
|
||||
await animation_player.animation_finished
|
||||
animation_player.play("idle")
|
||||
|
||||
|
||||
func start_throw() -> void:
|
||||
animation_player.play("start_throw")
|
||||
await animation_player.animation_finished
|
||||
|
||||
|
||||
func finish_throw() -> void:
|
||||
animation_player.play("finish_throw")
|
||||
await animation_player.animation_finished
|
||||
animation_player.play("idle")
|
||||
|
||||
|
||||
func hit(p_coconut: Node2D) -> void:
|
||||
p_coconut.hide()
|
||||
animation_player.play("hit")
|
||||
await animation_player.animation_finished
|
||||
animation_player.play("stunned")
|
||||
stunned = true
|
||||
|
||||
|
||||
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
||||
if anim_name == "idle":
|
||||
if randf() < 0.25:
|
||||
@@ -56,13 +93,15 @@ func _on_button_dragging() -> void:
|
||||
|
||||
|
||||
func _get_drag_data(at_position: Vector2):
|
||||
if locked:
|
||||
return null
|
||||
|
||||
var _drag_preview = drag_preview.duplicate()
|
||||
_drag_preview.show()
|
||||
button.set_drag_preview(_drag_preview)
|
||||
print(at_position)
|
||||
coconut.hide()
|
||||
return {
|
||||
object = self,
|
||||
monkey = self,
|
||||
start_position = button.global_position + at_position,
|
||||
}
|
||||
|
||||
@@ -72,10 +111,10 @@ func _can_drop_data(_at_position: Vector2, _data) -> bool:
|
||||
|
||||
|
||||
func _drop_data(at_position: Vector2, data) -> void:
|
||||
if data.object == self:
|
||||
if data.monkey == self:
|
||||
dragged_into_self.emit()
|
||||
else:
|
||||
dragged_into.emit(button.global_position + at_position - data.start_position)
|
||||
dragged_into.emit(button.global_position + at_position - data.start_position, data.monkey)
|
||||
|
||||
|
||||
func _on_drag_preview_tree_exiting() -> void:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=20 format=3 uid="uid://bp0b4xkr7nwed"]
|
||||
[gd_scene load_steps=22 format=3 uid="uid://bp0b4xkr7nwed"]
|
||||
|
||||
[ext_resource type="Script" path="res://sources/minigames/monkeys/monkey.gd" id="1_cvvgu"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0jobqj4fvrwy" path="res://assets/minigames/monkeys/graphic/monkey_spritesheet.png" id="2_awb1x"]
|
||||
@@ -6,6 +6,239 @@
|
||||
[ext_resource type="Texture2D" uid="uid://bh28uja7gs8u4" path="res://assets/minigames/monkeys/graphic/coconut.png" id="4_8r7im"]
|
||||
[ext_resource type="FontFile" uid="uid://b2l4jfylc1v41" path="res://assets/fonts/DidactGothic-Regular.ttf" id="5_4f7ge"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_64f28"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [18]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-124, -99)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [3.48787e-16]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Sprite2D:frame_coords")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [Vector2i(0, 8)]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("Marker2D:scale")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1)]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("Marker2D:visible")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_cp6hn"]
|
||||
resource_name = "finish_throw"
|
||||
length = 0.250012
|
||||
step = 0.125
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [33, 34, 35]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.25),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [-0.174533]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:position")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.25),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-192, -180)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Marker2D:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3amr0"]
|
||||
resource_name = "grab"
|
||||
length = 0.571443
|
||||
step = 0.0714286
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame_coords")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.142857, 0.285714, 0.428571),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2i(0, 8), Vector2i(1, 8), Vector2i(2, 8), Vector2i(3, 8)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.357143, 0.428571, 0.5, 0.571429),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-25, -42), Vector2(-25, -42), Vector2(-58, -61), Vector2(-91, -80), Vector2(-124, -99)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:scale")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.357143, 0.428571, 0.5, 0.571429),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.475, 0.475), Vector2(0.475, 0.475), Vector2(0.65, 0.65), Vector2(0.825, 0.825), Vector2(1, 1)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Marker2D:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0, 0.357143),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [false, true]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_fm776"]
|
||||
resource_name = "hit"
|
||||
length = 0.40001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [12, 13, 14, 15]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0.261799, -0.10472]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:position")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-74, -151), Vector2(-121, -61)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Marker2D:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_y7l2o"]
|
||||
resource_name = "idle"
|
||||
length = 0.857157
|
||||
@@ -47,48 +280,9 @@ tracks/2/keys = {
|
||||
"values": [0.0, -0.0837758, -0.0837758, 0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_64f28"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [18]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-124, -99)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [3.48787e-16]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_vwrnb"]
|
||||
resource_name = "talk"
|
||||
length = 0.428586
|
||||
[sub_resource type="Animation" id="Animation_c3yrh"]
|
||||
resource_name = "idle_blink"
|
||||
length = 0.857157
|
||||
step = 0.142857
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
@@ -97,27 +291,39 @@ tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.142857, 0.285714, 0.428571),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"times": PackedFloat32Array(0, 0.142857, 0.285714, 0.428571, 0.571429, 0.714286),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [36, 37, 38, 39]
|
||||
"values": [24, 25, 26, 27, 28, 29]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:rotation")
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.428571),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"times": PackedFloat32Array(0, 0.285714, 0.428571, 0.714286),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 0.0628319]
|
||||
"values": [Vector2(-124, -99), Vector2(-121, -79), Vector2(-121, -79), Vector2(-124, -99)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.285714, 0.428571, 0.714286),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, -0.0837758, -0.0837758, 0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_cp6hn"]
|
||||
resource_name = "throw"
|
||||
length = 0.625013
|
||||
[sub_resource type="Animation" id="Animation_0o2xa"]
|
||||
resource_name = "start_throw"
|
||||
length = 0.375012
|
||||
step = 0.125
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
@@ -156,46 +362,6 @@ tracks/2/keys = {
|
||||
"values": [Vector2(-124, -99), Vector2(-72, -144), Vector2(-192, -180)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_fm776"]
|
||||
resource_name = "hit"
|
||||
length = 0.40001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [12, 13, 14, 15]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0.261799, -0.10472]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:position")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-74, -151), Vector2(-121, -61)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ol2dg"]
|
||||
resource_name = "stunned"
|
||||
length = 0.857157
|
||||
@@ -238,9 +404,9 @@ tracks/2/keys = {
|
||||
"values": [42, 43, 44, 45, 46, 47]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_c3yrh"]
|
||||
resource_name = "idle_blink"
|
||||
length = 0.857157
|
||||
[sub_resource type="Animation" id="Animation_vwrnb"]
|
||||
resource_name = "talk"
|
||||
length = 0.428586
|
||||
step = 0.142857
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
@@ -249,45 +415,35 @@ tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.142857, 0.285714, 0.428571, 0.571429, 0.714286),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||
"times": PackedFloat32Array(0, 0.142857, 0.285714, 0.428571),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [24, 25, 26, 27, 28, 29]
|
||||
"values": [36, 37, 38, 39]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Marker2D:position")
|
||||
tracks/1/path = NodePath("Marker2D:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.285714, 0.428571, 0.714286),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"times": PackedFloat32Array(0, 0.428571),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-124, -99), Vector2(-121, -79), Vector2(-121, -79), Vector2(-124, -99)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Marker2D:rotation")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.285714, 0.428571, 0.714286),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, -0.0837758, -0.0837758, 0.0]
|
||||
"values": [0.0, 0.0628319]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_rnatx"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_64f28"),
|
||||
"finish_throw": SubResource("Animation_cp6hn"),
|
||||
"grab": SubResource("Animation_3amr0"),
|
||||
"hit": SubResource("Animation_fm776"),
|
||||
"idle": SubResource("Animation_y7l2o"),
|
||||
"idle_blink": SubResource("Animation_c3yrh"),
|
||||
"start_throw": SubResource("Animation_0o2xa"),
|
||||
"stunned": SubResource("Animation_ol2dg"),
|
||||
"talk": SubResource("Animation_vwrnb"),
|
||||
"throw": SubResource("Animation_cp6hn")
|
||||
"talk": SubResource("Animation_vwrnb")
|
||||
}
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cbnv3"]
|
||||
@@ -320,14 +476,20 @@ texture = ExtResource("2_awb1x")
|
||||
offset = Vector2(2.08165e-12, -54)
|
||||
hframes = 6
|
||||
vframes = 9
|
||||
frame = 18
|
||||
frame = 48
|
||||
|
||||
[node name="Marker2D" type="Marker2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(-124, -99)
|
||||
gizmo_extents = 20.0
|
||||
|
||||
[node name="Coconut" parent="Marker2D" instance=ExtResource("3_tws3c")]
|
||||
|
||||
[node name="HitPosition" type="Marker2D" parent="."]
|
||||
position = Vector2(-74, -151)
|
||||
rotation = 0.261799
|
||||
gizmo_extents = 20.0
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
autoplay = "idle"
|
||||
libraries = {
|
||||
|
||||
@@ -14,11 +14,15 @@ const difficulty_settings: = {
|
||||
@export var difficulty: = 1
|
||||
@export var lesson_nb: = 4
|
||||
@export var words_count: = 3
|
||||
@export var throw_to_king_duration: = 1.2
|
||||
@export var throw_to_monkey_duration: = 0.4
|
||||
|
||||
@onready var monkeys_node: = $GameRoot/Monkeys
|
||||
@onready var possible_positions_parent: = $GameRoot/PalmTreeMonkeys
|
||||
@onready var king: = $GameRoot/PlamTreeKing/KingMonkey
|
||||
@onready var word_label: = $GameRoot/TextPlank/MarginContainer/Label
|
||||
@onready var parabola_summit: = $GameRoot/ParabolaSummit
|
||||
@onready var text_plank: = $GameRoot/TextPlank
|
||||
|
||||
var monkeys: Array[Monkey] = []
|
||||
var _current_letter: = 0: set = _set_current_letter
|
||||
@@ -45,6 +49,8 @@ func _setup_minigame() -> void:
|
||||
monkey.global_position = possible_positions[i].global_position
|
||||
monkey.dragged_into.connect(_on_coconut_drag_end)
|
||||
monkeys.append(monkey)
|
||||
monkey.pressed.connect(_on_monkey_pressed.bind(monkey))
|
||||
monkey.dragged_into_self.connect(_on_monkey_pressed.bind(monkey))
|
||||
|
||||
# Will set up first word and monkeys
|
||||
current_progression = 0
|
||||
@@ -72,11 +78,9 @@ func _set_current_letter(p_current_letter: int) -> void:
|
||||
monkey.stimulus = grapheme_distractions[min(i, grapheme_distractions.size() - 1)]
|
||||
else:
|
||||
monkey.stimulus = grapheme_distractions[min(i - 1, grapheme_distractions.size() - 1)]
|
||||
|
||||
|
||||
## this is to use the drag and drop feature without its icons
|
||||
#func _process(delta: float) -> void:
|
||||
# DisplayServer.cursor_set_shape(DisplayServer.CURSOR_ARROW)
|
||||
monkey.stunned = false
|
||||
if _current_letter >= stimuli[current_progression].GPs.size() - 1:
|
||||
current_progression += 1
|
||||
|
||||
|
||||
# Find the stimuli and distractions of the minigame.
|
||||
@@ -98,13 +102,85 @@ func _find_stimuli_and_distractions() -> void:
|
||||
distractions.append(grapheme_distractions)
|
||||
|
||||
|
||||
func _start() -> void:
|
||||
await monkeys_grab_coconut()
|
||||
lock(false)
|
||||
|
||||
|
||||
func monkeys_grab_coconut() -> void:
|
||||
var coroutine: = Coroutine.new()
|
||||
for monkey in monkeys:
|
||||
coroutine.add_future(monkey.grab)
|
||||
await coroutine.join()
|
||||
|
||||
|
||||
func _monkeys_drop_data(at_position: Vector2, data) -> void:
|
||||
_on_coconut_drag_end(at_position - data.start_position)
|
||||
_on_coconut_drag_end(at_position - data.start_position, data.monkey)
|
||||
|
||||
|
||||
func _monkeys_can_drop_data(_at_position: Vector2, _data) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func _on_coconut_drag_end(vector: Vector2) -> void:
|
||||
print(vector.x)
|
||||
func _on_coconut_drag_end(vector: Vector2, monkey: Monkey) -> void:
|
||||
if vector.x < 0:
|
||||
monkey_throw_to_king(monkey)
|
||||
|
||||
|
||||
func monkey_throw_to_king(monkey: Monkey) -> void:
|
||||
lock()
|
||||
await monkey.start_throw()
|
||||
monkey.finish_throw()
|
||||
var coconut: = monkey.coconut.duplicate()
|
||||
game_root.add_child(coconut)
|
||||
coconut.text = monkey.coconut.text
|
||||
coconut.global_transform = monkey.coconut.global_transform
|
||||
var tween: = create_tween()
|
||||
tween.set_parallel()
|
||||
tween.tween_property(coconut, "global_position:x", (coconut.global_position.x + king.catch_position.global_position.x) / 2, throw_to_king_duration / 2).set_trans(Tween.TRANS_LINEAR)
|
||||
tween.tween_property(coconut, "global_position:y", parabola_summit.global_position.y, throw_to_king_duration / 2).set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
|
||||
await tween.finished
|
||||
tween = create_tween()
|
||||
tween.set_parallel()
|
||||
tween.tween_property(coconut, "global_position:x", king.catch_position.global_position.x, throw_to_king_duration / 2).set_trans(Tween.TRANS_LINEAR)
|
||||
tween.tween_property(coconut, "global_position:y", king.catch_position.global_position.y, throw_to_king_duration / 2).set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
|
||||
await tween.finished
|
||||
await king.catch(coconut)
|
||||
await king.read()
|
||||
|
||||
if monkey.stimulus == stimuli[current_progression].GPs[_current_letter]:
|
||||
await king.start_right()
|
||||
king.finish_right()
|
||||
tween = create_tween()
|
||||
coconut.show()
|
||||
coconut.global_transform = king.coconut.global_transform
|
||||
tween.tween_property(coconut, "global_position:y", text_plank.global_position.y, throw_to_monkey_duration).set_trans(Tween.TRANS_LINEAR)
|
||||
await tween.finished
|
||||
coconut.queue_free()
|
||||
word_label.text = ""
|
||||
for i in _current_letter + 1:
|
||||
word_label.text += stimuli[current_progression].Word[i]
|
||||
word_label.text += "_".repeat(stimuli[current_progression].Word.length() - _current_letter + 1)
|
||||
_current_letter += 1
|
||||
monkeys_grab_coconut()
|
||||
else:
|
||||
await king.start_wrong()
|
||||
king.finish_wrong()
|
||||
coconut.show()
|
||||
coconut.global_transform = king.coconut.global_transform
|
||||
tween = create_tween()
|
||||
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)
|
||||
lock(false)
|
||||
|
||||
|
||||
func lock(p_value: = true) -> void:
|
||||
for monkey in monkeys:
|
||||
monkey.locked = p_value
|
||||
|
||||
|
||||
func _on_monkey_pressed(monkey: Monkey) -> void:
|
||||
lock()
|
||||
await monkey.talk()
|
||||
lock(false)
|
||||
|
||||
@@ -18,9 +18,13 @@ spacing_glyph = 20
|
||||
|
||||
[node name="Monkeys" instance=ExtResource("1_6nhsm")]
|
||||
script = ExtResource("2_12lw5")
|
||||
difficulty = 4
|
||||
difficulty = 0
|
||||
lesson_nb = 10
|
||||
words_count = 3
|
||||
throw_to_king_duration = 1.2
|
||||
throw_to_monkey_duration = 0.7
|
||||
max_number_of_lives = 5
|
||||
max_progression = 3
|
||||
help_kalulu_speech = ExtResource("3_hhwrg")
|
||||
win_kalulu_speech = ExtResource("4_oe2vh")
|
||||
|
||||
@@ -135,3 +139,10 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="ParabolaSummit" type="Control" parent="GameRoot" index="5"]
|
||||
anchors_preset = 0
|
||||
offset_left = 1316.0
|
||||
offset_top = 36.0
|
||||
offset_right = 1356.0
|
||||
offset_bottom = 76.0
|
||||
|
||||
Reference in New Issue
Block a user