mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-24 09:04:22 +00:00
Add animations!
This commit is contained in:
parent
9200308f40
commit
70bc60a8e8
10 changed files with 504 additions and 32 deletions
|
@ -4,6 +4,7 @@ class_name Imp
|
|||
|
||||
@onready var sprite: SpriteLeftRight = $"Sprite"
|
||||
@onready var eater: Eater = $"Eater"
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
|
||||
|
||||
func _on_move(movement: Vector2):
|
||||
|
@ -18,9 +19,11 @@ func _on_dragged(_cursor: Cursor) -> void:
|
|||
collision_mask = 18
|
||||
z_index = 1
|
||||
eater.collision_mask = 16
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
z_index = 0
|
||||
eater.collision_mask = 8
|
||||
animator.play(&"RESET")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=24 format=3 uid="uid://4d3ksr3171x4"]
|
||||
[gd_scene load_steps=28 format=3 uid="uid://4d3ksr3171x4"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/imp.gd" id="1_dixpc"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxbjfev0lhwws" path="res://behaviours/sprite_left_right.tscn" id="2_eqcdi"]
|
||||
|
@ -23,6 +23,120 @@
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_ide4n"]
|
||||
radius = 32.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gokbg"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2, 2)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Sprite:position")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5yt72"]
|
||||
resource_name = "drag_loop"
|
||||
loop_mode = 2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2.4, 2.4)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Sprite:position")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(-2, -2), Vector2(1, -1), Vector2(-1, 1), Vector2(1, 1), Vector2(-2, 0), Vector2(1, 1), Vector2(1, -1), Vector2(-1, 1), Vector2(2, 0), Vector2(-1, -1), Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2igbw"]
|
||||
resource_name = "drag_start"
|
||||
length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2, 2), Vector2(2.4, 2.4)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_d6oim"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_gokbg"),
|
||||
"drag_loop": SubResource("Animation_5yt72"),
|
||||
"drag_start": SubResource("Animation_2igbw")
|
||||
}
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_1bmhf"]
|
||||
radius = 256.0
|
||||
|
||||
|
@ -47,6 +161,14 @@ right_texture = ExtResource("4_0sckn")
|
|||
[node name="Shape" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_ide4n")
|
||||
|
||||
[node name="Animator" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_d6oim")
|
||||
}
|
||||
next/drag_loop = &"drag_loop"
|
||||
next/drag_start = &"drag_loop"
|
||||
|
||||
[node name="GoldSpawner" parent="." instance=ExtResource("4_d8lgm")]
|
||||
scene = ExtResource("5_yrfoq")
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@ extends CharacterBody2D
|
|||
class_name Monocle
|
||||
|
||||
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
|
||||
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
move_and_collide(movement)
|
||||
|
||||
|
@ -9,8 +12,10 @@ func _on_dragged(_cursor: Cursor) -> void:
|
|||
collision_layer = 16
|
||||
collision_mask = 18
|
||||
z_index = 1
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
z_index = 0
|
||||
animator.play(&"RESET")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://b04xhv32ypi42"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://b04xhv32ypi42"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/monocle.gd" id="1_ehpfj"]
|
||||
[ext_resource type="Texture2D" uid="uid://d3tb6ypb36v8e" path="res://entities/monocle.png" id="1_omrit"]
|
||||
|
@ -10,6 +10,97 @@
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_o7chm"]
|
||||
radius = 12.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gokbg"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2, 2)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5yt72"]
|
||||
resource_name = "drag_loop"
|
||||
length = 1.2
|
||||
step = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2.4, 2.4)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2igbw"]
|
||||
resource_name = "drag_start"
|
||||
length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2, 2), Vector2(2.4, 2.4)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_wxlwx"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_gokbg"),
|
||||
"drag_loop": SubResource("Animation_5yt72"),
|
||||
"drag_start": SubResource("Animation_2igbw")
|
||||
}
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_juisb"]
|
||||
radius = 12.0
|
||||
|
||||
|
@ -26,6 +117,14 @@ texture = ExtResource("1_omrit")
|
|||
[node name="Shape" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_o7chm")
|
||||
|
||||
[node name="Animator" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_wxlwx")
|
||||
}
|
||||
next/drag_loop = &"drag_loop"
|
||||
next/drag_start = &"drag_loop"
|
||||
|
||||
[node name="MovementDrag" parent="." instance=ExtResource("2_jgnsw")]
|
||||
|
||||
[node name="Draggable" parent="MovementDrag" instance=ExtResource("3_e0ni5")]
|
||||
|
|
|
@ -3,12 +3,9 @@ class_name Sheep
|
|||
|
||||
|
||||
@onready var sprite: SpriteLeftRight = $"Sprite"
|
||||
@onready var animator: AnimationPlayer = $"Animator"
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
animator.play("RESET")
|
||||
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
move_and_collide(movement)
|
||||
sprite.handle_move(movement)
|
||||
|
@ -17,8 +14,10 @@ func _on_dragged(_cursor: Cursor) -> void:
|
|||
collision_layer = 16
|
||||
collision_mask = 18
|
||||
z_index = 1
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
z_index = 0
|
||||
animator.play(&"RESET")
|
||||
|
|
|
@ -26,57 +26,90 @@ length = 0.001
|
|||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:rotation")
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2, 2)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_s7ekl"]
|
||||
resource_name = "shake"
|
||||
length = 0.5
|
||||
loop_mode = 1
|
||||
step = 0.05
|
||||
[sub_resource type="Animation" id="Animation_5yt72"]
|
||||
resource_name = "drag_loop"
|
||||
length = 1.2
|
||||
step = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:position")
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, 0), Vector2(1, 1), Vector2(-1, -1), Vector2(-1, 0), Vector2(1, -1), Vector2(-1, 1), Vector2(1, 1), Vector2(1, 0), Vector2(-1, -1), Vector2(1, 0), Vector2(0, -1)]
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2.4, 2.4)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_lxieb"]
|
||||
resource_name = "wobble"
|
||||
length = 3.0
|
||||
loop_mode = 1
|
||||
step = 0.5
|
||||
[sub_resource type="Animation" id="Animation_2igbw"]
|
||||
resource_name = "drag_start"
|
||||
length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:rotation")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5, 1.5, 2, 3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, -0.261799, 0.0, 0.261799, 0.0]
|
||||
"values": [Vector2(2, 2), Vector2(2.4, 2.4)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_6mutq"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_gokbg"),
|
||||
"shake": SubResource("Animation_s7ekl"),
|
||||
"wobble": SubResource("Animation_lxieb")
|
||||
"drag_loop": SubResource("Animation_5yt72"),
|
||||
"drag_start": SubResource("Animation_2igbw")
|
||||
}
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_etpf6"]
|
||||
|
@ -89,7 +122,6 @@ motion_mode = 1
|
|||
script = ExtResource("1_4dmll")
|
||||
|
||||
[node name="Sprite" parent="." instance=ExtResource("2_xbkrm")]
|
||||
position = Vector2(1, 1)
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("2_t13f5")
|
||||
left_texture = ExtResource("2_t13f5")
|
||||
|
@ -100,9 +132,12 @@ scale = Vector2(3, 3)
|
|||
shape = SubResource("CircleShape2D_c5tcn")
|
||||
|
||||
[node name="Animator" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_6mutq")
|
||||
}
|
||||
next/drag_loop = &"drag_loop"
|
||||
next/drag_start = &"drag_loop"
|
||||
|
||||
[node name="Edible" parent="." instance=ExtResource("6_3odsh")]
|
||||
diet = &"Meat"
|
||||
|
|
|
@ -2,6 +2,9 @@ extends CharacterBody2D
|
|||
class_name Skull
|
||||
|
||||
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
|
||||
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
move_and_collide(movement)
|
||||
|
||||
|
@ -9,8 +12,10 @@ func _on_dragged(_cursor: Cursor) -> void:
|
|||
collision_layer = 16
|
||||
collision_mask = 18
|
||||
z_index = 1
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
z_index = 0
|
||||
animator.play(&"RESET")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://b3gydtrenbw3n"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://b3gydtrenbw3n"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/skull.gd" id="1_7g8bu"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwvvwjdexdywh" path="res://entities/skull.png" id="1_v6qk3"]
|
||||
|
@ -10,6 +10,97 @@
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_ypibs"]
|
||||
radius = 12.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gokbg"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2, 2)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5yt72"]
|
||||
resource_name = "drag_loop"
|
||||
length = 1.2
|
||||
step = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2.4, 2.4)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2igbw"]
|
||||
resource_name = "drag_start"
|
||||
length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2, 2), Vector2(2.4, 2.4)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_wxlwx"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_gokbg"),
|
||||
"drag_loop": SubResource("Animation_5yt72"),
|
||||
"drag_start": SubResource("Animation_2igbw")
|
||||
}
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_1c7gd"]
|
||||
radius = 12.0
|
||||
|
||||
|
@ -20,12 +111,21 @@ motion_mode = 1
|
|||
script = ExtResource("1_7g8bu")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
position = Vector2(2, 0)
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("1_v6qk3")
|
||||
|
||||
[node name="Shape" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_ypibs")
|
||||
|
||||
[node name="Animator" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_wxlwx")
|
||||
}
|
||||
next/drag_loop = &"drag_loop"
|
||||
next/drag_start = &"drag_loop"
|
||||
|
||||
[node name="MovementDrag" parent="." instance=ExtResource("3_83m1a")]
|
||||
|
||||
[node name="Draggable" parent="MovementDrag" instance=ExtResource("2_h0icd")]
|
||||
|
|
|
@ -2,6 +2,9 @@ extends CharacterBody2D
|
|||
class_name TopHat
|
||||
|
||||
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
|
||||
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
move_and_collide(movement)
|
||||
|
||||
|
@ -9,8 +12,10 @@ func _on_dragged(_cursor: Cursor) -> void:
|
|||
collision_layer = 16
|
||||
collision_mask = 18
|
||||
z_index = 1
|
||||
animator.play(&"drag_start")
|
||||
|
||||
func _on_fallen() -> void:
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
z_index = 0
|
||||
animator.play(&"RESET")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://8ejgwtkpaa44"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://8ejgwtkpaa44"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/top_hat.gd" id="1_0eh11"]
|
||||
[ext_resource type="Texture2D" uid="uid://deqvgvf66grr4" path="res://entities/top_hat.png" id="1_gbqic"]
|
||||
|
@ -9,6 +9,97 @@
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_o7chm"]
|
||||
radius = 12.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gokbg"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2, 2)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5yt72"]
|
||||
resource_name = "drag_loop"
|
||||
length = 1.2
|
||||
step = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2.4, 2.4)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2igbw"]
|
||||
resource_name = "drag_start"
|
||||
length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(2, 2), Vector2(2.4, 2.4)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite:rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ef228"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_gokbg"),
|
||||
"drag_loop": SubResource("Animation_5yt72"),
|
||||
"drag_start": SubResource("Animation_2igbw")
|
||||
}
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_juisb"]
|
||||
radius = 12.0
|
||||
|
||||
|
@ -25,6 +116,14 @@ texture = ExtResource("1_gbqic")
|
|||
[node name="Shape" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_o7chm")
|
||||
|
||||
[node name="Animator" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_ef228")
|
||||
}
|
||||
next/drag_loop = &"drag_loop"
|
||||
next/drag_start = &"drag_loop"
|
||||
|
||||
[node name="MovementDrag" parent="." instance=ExtResource("3_gy414")]
|
||||
|
||||
[node name="Draggable" parent="MovementDrag" instance=ExtResource("4_fcvjo")]
|
||||
|
|
Loading…
Reference in a new issue