1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-24 17:14:23 +00:00

Add sheep drag animation

Co-authored-by: Maxim Lobovsky <mex.lobo@mail.ru>
This commit is contained in:
Steffo 2024-04-26 01:19:27 +02:00
parent 5dfd81687a
commit 56a39892e0
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
8 changed files with 162 additions and 7 deletions

View file

@ -5,9 +5,15 @@ class_name SpriteLeftRight
@export var left_texture: Texture2D
@export var right_texture: Texture2D
var last_discrim: float = 0
func handle_move(movement: Vector2):
if movement.x > 0:
var discrim = movement.x
if discrim == 0:
discrim = last_discrim
if discrim > 0:
texture = right_texture
elif movement.x < 0:
last_discrim = discrim
elif discrim < 0:
texture = left_texture
last_discrim = discrim

View file

@ -1,10 +1,12 @@
[gd_scene load_steps=24 format=3 uid="uid://bc2bm8lbol18w"]
[gd_scene load_steps=26 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"]
[ext_resource type="PackedScene" uid="uid://bxbjfev0lhwws" path="res://behaviours/sprite_left_right.tscn" id="2_xbkrm"]
[ext_resource type="Texture2D" uid="uid://cxtmas4g0v6en" path="res://entities/sheep_right.png" id="4_5qoof"]
[ext_resource type="Texture2D" uid="uid://cfduc7cdorasr" path="res://entities/sheep_drag_left.png" id="5_gh6h6"]
[ext_resource type="PackedScene" uid="uid://dfdr3e32lohq" path="res://behaviours/edible.tscn" id="6_3odsh"]
[ext_resource type="Texture2D" uid="uid://m5bebwb06kqe" path="res://entities/sheep_drag_right.png" id="6_x4fsj"]
[ext_resource type="PackedScene" uid="uid://djcwis8ycrq85" path="res://behaviours/sampler_priority.tscn" id="9_s5lod"]
[ext_resource type="PackedScene" uid="uid://dk1ipq7dhkhf3" path="res://behaviours/move_straight.tscn" id="10_05kcd"]
[ext_resource type="PackedScene" uid="uid://cm67ko1k6kn4u" path="res://behaviours/priority.tscn" id="11_0jlmk"]
@ -47,6 +49,30 @@ tracks/1/keys = {
"update": 0,
"values": [0.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite:left_texture")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("2_t13f5")]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Sprite:right_texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("4_5qoof")]
}
[sub_resource type="Animation" id="Animation_5yt72"]
resource_name = "drag_loop"
@ -76,6 +102,30 @@ tracks/1/keys = {
"update": 0,
"values": [0.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite:left_texture")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("5_gh6h6")]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Sprite:right_texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("6_x4fsj")]
}
[sub_resource type="Animation" id="Animation_2igbw"]
resource_name = "drag_start"
@ -104,6 +154,30 @@ tracks/1/keys = {
"update": 0,
"values": [0.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite:left_texture")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("5_gh6h6")]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Sprite:right_texture")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("6_x4fsj")]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_6mutq"]
_data = {
@ -122,6 +196,7 @@ motion_mode = 1
script = ExtResource("1_4dmll")
[node name="Sprite" parent="." instance=ExtResource("2_xbkrm")]
position = Vector2(0, -4)
scale = Vector2(2, 2)
texture = ExtResource("2_t13f5")
left_texture = ExtResource("2_t13f5")

BIN
entities/sheep_drag_left.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cfduc7cdorasr"
path="res://.godot/imported/sheep_drag_left.png-a7c04bb39da88d0f0854bbdfbabc6662.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/sheep_drag_left.png"
dest_files=["res://.godot/imported/sheep_drag_left.png-a7c04bb39da88d0f0854bbdfbabc6662.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
entities/sheep_drag_right.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://m5bebwb06kqe"
path="res://.godot/imported/sheep_drag_right.png-3946842e67ee30d62560fdb07c61bedb.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/sheep_drag_right.png"
dest_files=["res://.godot/imported/sheep_drag_right.png-3946842e67ee30d62560fdb07c61bedb.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
entities/sheep_left.png (Stored with Git LFS)

Binary file not shown.

BIN
entities/sheep_right.png (Stored with Git LFS)

Binary file not shown.