mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 15:44:23 +00:00
Add a couple of sheep animations
This commit is contained in:
parent
034bdc6bd0
commit
fb78e3f001
2 changed files with 71 additions and 1 deletions
|
@ -6,8 +6,12 @@ class_name Sheep
|
|||
@onready var sprite: SpriteLeftRight = $"Sprite"
|
||||
@onready var drag_sound: AudioStreamPlayer2D = $"Draggable/DragSound"
|
||||
@onready var drop_sound: AudioStreamPlayer2D = $"Draggable/DropSound"
|
||||
@onready var animator: AnimationPlayer = $"Animator"
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
animator.play("RESET")
|
||||
|
||||
func _on_move(movement: Vector2) -> void:
|
||||
if not draggable.being_dragged:
|
||||
move_and_collide(movement)
|
||||
|
@ -20,6 +24,8 @@ func _on_drag_move(movement: Vector2) -> void:
|
|||
|
||||
func _on_draggable_dragged() -> void:
|
||||
drag_sound.play()
|
||||
animator.play("wobble")
|
||||
|
||||
func _on_draggable_dropped() -> void:
|
||||
drop_sound.play()
|
||||
animator.play("RESET")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://bc2bm8lbol18w"]
|
||||
[gd_scene load_steps=15 format=3 uid="uid://bc2bm8lbol18w"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/sheep.gd" id="1_4dmll"]
|
||||
[ext_resource type="Texture2D" uid="uid://iljp5yn3ehfk" path="res://entities/sheep_left.png" id="2_t13f5"]
|
||||
|
@ -13,12 +13,71 @@
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_c5tcn"]
|
||||
radius = 8.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_lxieb"]
|
||||
resource_name = "wobble"
|
||||
length = 3.0
|
||||
loop_mode = 1
|
||||
step = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:rotation")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5, 1.5, 2, 3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, -0.261799, 0.0, 0.261799, 0.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:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/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
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite:position")
|
||||
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)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_6mutq"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_gokbg"),
|
||||
"shake": SubResource("Animation_s7ekl"),
|
||||
"wobble": SubResource("Animation_lxieb")
|
||||
}
|
||||
|
||||
[node name="Sheep" type="CharacterBody2D"]
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
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")
|
||||
|
@ -47,6 +106,11 @@ stream = ExtResource("4_nxjnl")
|
|||
[node name="Edible" parent="." instance=ExtResource("6_3odsh")]
|
||||
tag = &"Sheep"
|
||||
|
||||
[node name="Animator" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_6mutq")
|
||||
}
|
||||
|
||||
[connection signal="move" from="MoveTowardsMouse" to="." method="_on_move"]
|
||||
[connection signal="dragged" from="Draggable" to="." method="_on_draggable_dragged"]
|
||||
[connection signal="dropped" from="Draggable" to="." method="_on_draggable_dropped"]
|
||||
|
|
Loading…
Reference in a new issue