adding movie animation
This commit is contained in:
parent
d255435c93
commit
d29a1ff019
3 changed files with 32 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=11 format=3 uid="uid://snxpqx0ony7s"]
|
[gd_scene load_steps=12 format=3 uid="uid://snxpqx0ony7s"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/player_movement.gd" id="1_a6lhy"]
|
[ext_resource type="Script" path="res://scripts/player_movement.gd" id="1_a6lhy"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bnj38vubchr2w" path="res://textures/Virus-Player-Sheet.png" id="2_183nu"]
|
[ext_resource type="Texture2D" uid="uid://bnj38vubchr2w" path="res://textures/Virus-Player-Sheet.png" id="2_183nu"]
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_ahrep"]
|
[sub_resource type="Animation" id="Animation_ahrep"]
|
||||||
resource_name = "idle"
|
resource_name = "idle"
|
||||||
length = 0.4
|
length = 0.6
|
||||||
loop_mode = 1
|
loop_mode = 1
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
|
@ -18,7 +18,7 @@ tracks/0/path = NodePath("Sprite2D:frame_coords")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667, 0.333333),
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
|
||||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [Vector2i(0, 0), Vector2i(1, 0), Vector2i(2, 0), Vector2i(3, 0), Vector2i(4, 0), Vector2i(5, 0)]
|
"values": [Vector2i(0, 0), Vector2i(1, 0), Vector2i(2, 0), Vector2i(3, 0), Vector2i(4, 0), Vector2i(5, 0)]
|
||||||
|
@ -39,8 +39,10 @@ tracks/0/keys = {
|
||||||
"values": [Vector2i(0, 0)]
|
"values": [Vector2i(0, 0)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_1wyqk"]
|
[sub_resource type="Animation" id="Animation_fl3gq"]
|
||||||
resource_name = "moving"
|
resource_name = "moving_right"
|
||||||
|
length = 0.6
|
||||||
|
loop_mode = 1
|
||||||
tracks/0/type = "value"
|
tracks/0/type = "value"
|
||||||
tracks/0/imported = false
|
tracks/0/imported = false
|
||||||
tracks/0/enabled = true
|
tracks/0/enabled = true
|
||||||
|
@ -48,17 +50,35 @@ tracks/0/path = NodePath("Sprite2D:frame_coords")
|
||||||
tracks/0/interp = 1
|
tracks/0/interp = 1
|
||||||
tracks/0/loop_wrap = true
|
tracks/0/loop_wrap = true
|
||||||
tracks/0/keys = {
|
tracks/0/keys = {
|
||||||
"times": PackedFloat32Array(0),
|
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
|
||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [Vector2i(0, 0)]
|
"values": [Vector2i(0, 1), Vector2i(1, 1), Vector2i(2, 1), Vector2i(3, 1), Vector2i(4, 1), Vector2i(5, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_g0oas"]
|
||||||
|
resource_name = "moving_left"
|
||||||
|
length = 0.6
|
||||||
|
loop_mode = 1
|
||||||
|
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.1, 0.2, 0.3, 0.4, 0.5),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [Vector2i(0, 2), Vector2i(1, 2), Vector2i(2, 2), Vector2i(3, 2), Vector2i(4, 2), Vector2i(5, 2)]
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hrlyn"]
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hrlyn"]
|
||||||
_data = {
|
_data = {
|
||||||
"RESET": SubResource("Animation_g8ois"),
|
"RESET": SubResource("Animation_g8ois"),
|
||||||
"idle": SubResource("Animation_ahrep"),
|
"idle": SubResource("Animation_ahrep"),
|
||||||
"moving": SubResource("Animation_1wyqk")
|
"moving_left": SubResource("Animation_g0oas"),
|
||||||
|
"moving_right": SubResource("Animation_fl3gq")
|
||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_vxfel"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_vxfel"]
|
||||||
|
@ -79,6 +99,7 @@ shape = SubResource("RectangleShape2D_31jvr")
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
texture = ExtResource("2_183nu")
|
texture = ExtResource("2_183nu")
|
||||||
hframes = 6
|
hframes = 6
|
||||||
|
vframes = 3
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
libraries = {
|
libraries = {
|
||||||
|
|
|
@ -60,10 +60,10 @@ func get_input(delta):
|
||||||
if left and right:
|
if left and right:
|
||||||
input_direction = 0
|
input_direction = 0
|
||||||
elif left:
|
elif left:
|
||||||
animation.play("RESET")
|
animation.play("moving_left")
|
||||||
input_direction = -1
|
input_direction = -1
|
||||||
elif right:
|
elif right:
|
||||||
animation.play("RESET")
|
animation.play("moving_right")
|
||||||
input_direction = 1
|
input_direction = 1
|
||||||
else:
|
else:
|
||||||
animation.play("idle")
|
animation.play("idle")
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.7 KiB |
Loading…
Add table
Reference in a new issue