Movement animation
This commit is contained in:
parent
b4a6dadc43
commit
ab7885a3e6
4 changed files with 251 additions and 177 deletions
|
@ -42,6 +42,49 @@ tracks/1/keys = {
|
|||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_vwudn"]
|
||||
resource_name = "draw"
|
||||
length = 0.30001
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("14_t6dve"), ExtResource("13_p7jc5"), ExtResource("12_vwudn")]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/2/type = "method"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../..")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.3),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"finish_task"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8sdfx"]
|
||||
resource_name = "shoot"
|
||||
length = 0.30001
|
||||
|
@ -73,6 +116,49 @@ tracks/1/keys = {
|
|||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5sdma"]
|
||||
resource_name = "holster"
|
||||
length = 0.40001
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(-7.45058e-09, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("12_vwudn"), ExtResource("13_p7jc5"), ExtResource("14_t6dve")]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(-7.45058e-09, 0.2, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [true, true, false]
|
||||
}
|
||||
tracks/2/type = "method"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../..")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.4),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"finish_task"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_08xoc"]
|
||||
resource_name = "reload"
|
||||
length = 1.10001
|
||||
|
@ -121,92 +207,6 @@ tracks/0/keys = {
|
|||
"values": [ExtResource("11_fahg7")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5sdma"]
|
||||
resource_name = "holster"
|
||||
length = 0.40001
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(-7.45058e-09, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("12_vwudn"), ExtResource("13_p7jc5"), ExtResource("14_t6dve")]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(-7.45058e-09, 0.2, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [true, true, false]
|
||||
}
|
||||
tracks/2/type = "method"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../..")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.4),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"finish_task"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_vwudn"]
|
||||
resource_name = "draw"
|
||||
length = 0.30001
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("14_t6dve"), ExtResource("13_p7jc5"), ExtResource("12_vwudn")]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/2/type = "method"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../..")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.3),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"finish_task"
|
||||
}]
|
||||
}
|
||||
|
||||
[resource]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_i1xqq"),
|
||||
|
|
|
@ -42,6 +42,49 @@ tracks/1/keys = {
|
|||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_y82fu"]
|
||||
resource_name = "draw"
|
||||
length = 0.30001
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("14_x8exi"), ExtResource("13_7aydm"), ExtResource("12_y82fu")]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/2/type = "method"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../..")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.3),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"finish_task"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8sdfx"]
|
||||
resource_name = "shoot"
|
||||
length = 0.30001
|
||||
|
@ -73,6 +116,49 @@ tracks/1/keys = {
|
|||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bkso5"]
|
||||
resource_name = "holster"
|
||||
length = 0.40001
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(7.45058e-09, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("12_y82fu"), ExtResource("13_7aydm"), ExtResource("14_x8exi")]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(7.45058e-09, 0.2, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [true, true, false]
|
||||
}
|
||||
tracks/2/type = "method"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../..")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.4),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"finish_task"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_08xoc"]
|
||||
resource_name = "reload"
|
||||
length = 1.10001
|
||||
|
@ -121,92 +207,6 @@ tracks/0/keys = {
|
|||
"values": [ExtResource("1_yheqn")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bkso5"]
|
||||
resource_name = "holster"
|
||||
length = 0.40001
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(7.45058e-09, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("12_y82fu"), ExtResource("13_7aydm"), ExtResource("14_x8exi")]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(7.45058e-09, 0.2, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [true, true, false]
|
||||
}
|
||||
tracks/2/type = "method"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../..")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.4),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"finish_task"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_y82fu"]
|
||||
resource_name = "draw"
|
||||
length = 0.30001
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [ExtResource("14_x8exi"), ExtResource("13_7aydm"), ExtResource("12_y82fu")]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:visible")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/2/type = "method"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("../..")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.3),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"finish_task"
|
||||
}]
|
||||
}
|
||||
|
||||
[resource]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_i1xqq"),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://dwx5tcatj35gu"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://dwx5tcatj35gu"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dts8lbivkgsmj" path="res://base/scripts/player/player.gd" id="1_1w3ab"]
|
||||
[ext_resource type="Texture2D" uid="uid://dxmu14ucuokfl" path="res://base/assets/sprites/guns/placeholder/holster3.png" id="2_gt0rj"]
|
||||
[ext_resource type="Texture2D" uid="uid://cf7avgppv4kfk" path="res://base/assets/sprites/guns/placeholder/static.png" id="2_gt0rj"]
|
||||
[ext_resource type="PackedScene" uid="uid://bb6ovrbusyxpi" path="res://base/scenes/weapons/weapon_base.tscn" id="2_ma1q3"]
|
||||
[ext_resource type="Script" uid="uid://byhp4pklbjltn" path="res://base/scripts/player/weapon_container.gd" id="3_1w3ab"]
|
||||
[ext_resource type="Script" uid="uid://diu6eno2ag6ga" path="res://base/scripts/player/weapon_slot.gd" id="4_gt0rj"]
|
||||
|
@ -9,6 +9,62 @@
|
|||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jjqxs"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8sdfx"]
|
||||
resource_name = "default"
|
||||
length = 1.33334
|
||||
loop_mode = 1
|
||||
step = 0.0166667
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("HUD/Weapon:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.333333, 0.666667, 1, 1.33333),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(16, 32), Vector2(0, 0), Vector2(32, 32), Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gt0rj"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("HUD/Weapon:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_juj2l"]
|
||||
resource_name = "static"
|
||||
step = 0.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("HUD/Weapon:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.00466507),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_juj2l"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_gt0rj"),
|
||||
&"default": SubResource("Animation_8sdfx"),
|
||||
&"static": SubResource("Animation_juj2l")
|
||||
}
|
||||
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
collision_layer = 2
|
||||
collision_mask = 3
|
||||
|
@ -69,3 +125,9 @@ metadata/_custom_type_script = "uid://diu6eno2ag6ga"
|
|||
[node name="Tertiary" type="Node3D" parent="WeaponContainer"]
|
||||
script = ExtResource("4_gt0rj")
|
||||
metadata/_custom_type_script = "uid://diu6eno2ag6ga"
|
||||
|
||||
[node name="MovementPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_juj2l")
|
||||
}
|
||||
blend_times = [&"goto_static", &"static", 0.5]
|
||||
|
|
|
@ -10,6 +10,7 @@ var queue_data: Dictionary = {}
|
|||
|
||||
@onready var camera: Camera3D = $"Camera"
|
||||
@onready var weapon_player: AnimationPlayer = $"HUD/Weapon/AnimationPlayer"
|
||||
@onready var movement_player: AnimationPlayer = $"MovementPlayer"
|
||||
@onready var weapons: WeaponContainer = $"WeaponContainer"
|
||||
|
||||
# Placeholder UI
|
||||
|
@ -20,6 +21,8 @@ var current_weapon:Weapon
|
|||
var slot_actions: Array[StringName] = [ "slot_primary", "slot_secondary", "slot_tertiary" ]
|
||||
|
||||
func _ready() -> void:
|
||||
movement_player.play('static')
|
||||
|
||||
queue.command_pushed.connect(on_queue_command_pushed)
|
||||
queue.command_popped.connect(on_queue_command_popped)
|
||||
queue.command_started.connect(on_queue_command_started)
|
||||
|
@ -50,11 +53,14 @@ func _process(_delta: float) -> void:
|
|||
|
||||
# Slot changing logic
|
||||
var slot_action = false
|
||||
var slot_id = 0
|
||||
for slot in slot_actions.size():
|
||||
if Input.is_action_just_pressed(slot_actions[slot]):
|
||||
slot_action = true
|
||||
queue_data['slot_id'] = slot
|
||||
if slot_action:
|
||||
slot_id = slot
|
||||
if slot_action and weapons.slots[slot_id].has_weapon \
|
||||
and weapons.current_slot != weapons.slots[slot_id]:
|
||||
queue_data['slot_id'] = slot_id
|
||||
push_copied_command(CommandQueue.Command.HOLSTER_WEAPON, weapon_sides)
|
||||
|
||||
# Stop firing logic
|
||||
|
@ -82,6 +88,12 @@ func _physics_process(delta: float) -> void:
|
|||
target_velocity.y -= fall_acceleration * delta
|
||||
|
||||
velocity = target_velocity
|
||||
|
||||
if velocity == Vector3.ZERO and movement_player.current_animation == 'default':
|
||||
movement_player.play('static')
|
||||
elif movement_player.current_animation == 'static':
|
||||
movement_player.play('default')
|
||||
|
||||
move_and_slide()
|
||||
|
||||
func _input(event):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue