initial implementation of sword attack

This commit is contained in:
2021-12-04 02:28:48 -06:00
parent 7e39fdf2bc
commit f18924dd3d
10 changed files with 203 additions and 89 deletions

76
Player/Sword.tscn Normal file
View File

@@ -0,0 +1,76 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Sprites/Items/Sword.png" type="Texture" id=1]
[ext_resource path="res://Player/Sword.gd" type="Script" id=2]
[sub_resource type="Animation" id=4]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("Sword:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 45.0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sword:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 8, -7 ) ]
}
[sub_resource type="Animation" id=5]
resource_name = "swing"
length = 0.3
tracks/0/type = "value"
tracks/0/path = NodePath("Sword:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.3 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( 2, 7 ), Vector2( 2, 7 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sword:rotation_degrees")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.1, 0.3 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ 45.0, 180.0, 180.0 ]
}
[node name="SwordAnimation" type="Node2D"]
script = ExtResource( 2 )
[node name="Sword" type="Sprite" parent="."]
visible = false
position = Vector2( 8, -7 )
rotation = 0.785398
scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 1 )
[node name="SwordAttack" type="AnimationPlayer" parent="."]
anims/RESET = SubResource( 4 )
anims/swing = SubResource( 5 )
[connection signal="animation_finished" from="SwordAttack" to="." method="_on_SwordAttack_animation_finished"]
[connection signal="animation_started" from="SwordAttack" to="." method="_on_SwordAttack_animation_started"]