Not perfect but enemies move/attack with animation
This commit is contained in:
@@ -65,6 +65,8 @@ namespace GameJamDungeon
|
||||
|
||||
private PlayerData PlayerData { get; set; } = default!;
|
||||
|
||||
private bool flipAttack = false;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
AnimationPlayer.AnimationFinished += OnAnimationFinished;
|
||||
@@ -120,8 +122,8 @@ namespace GameJamDungeon
|
||||
{
|
||||
var attackSpeed = PlayerData.Inventory.EquippedWeapon.Value.WeaponStats.AttackSpeed;
|
||||
AnimationPlayer.SetSpeedScale((float)attackSpeed);
|
||||
|
||||
AnimationPlayer.Play("attack");
|
||||
SwordSlashAnimation.Play("attack");
|
||||
})
|
||||
.Handle((in PlayerLogic.Output.ThrowItem output) =>
|
||||
{
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=34 format=3 uid="uid://cfecvvav8kkp6"]
|
||||
[gd_scene load_steps=46 format=3 uid="uid://cfecvvav8kkp6"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/player/Player.cs" id="1_xcol5"]
|
||||
[ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="2_lb3qc"]
|
||||
[ext_resource type="Script" path="res://src/player/PlayerStatResource.cs" id="2_xq68d"]
|
||||
[ext_resource type="Texture2D" uid="uid://c6r3dhnkuw22w" path="res://src/vfx/Weapon Strikes/FIRE_STRIKE_1.0.png" id="5_wr6lo"]
|
||||
[ext_resource type="Texture2D" uid="uid://c6r3dhnkuw22w" path="res://src/vfx/hit_effects/FIRE_STRIKE_1.0.png" id="5_wr6lo"]
|
||||
[ext_resource type="Texture2D" uid="uid://b5qjlbcesth53" path="res://src/vfx/Weapon Strikes/NON ELEMENTAL SLASH.png" id="6_p34sl"]
|
||||
[ext_resource type="PackedScene" uid="uid://ctwtksu2406c" path="res://src/player/dont_look_in_here/player_model.tscn" id="10_prmgx"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_btp2w"]
|
||||
@@ -48,10 +49,23 @@ tracks/0/keys = {
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("SwordSlashAnimation:frame")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_0jjwv"]
|
||||
resource_name = "attack"
|
||||
length = 0.7
|
||||
length = 0.916675
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
@@ -59,18 +73,76 @@ tracks/0/path = NodePath("Hitbox/HitboxCollision:disabled")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1667, 0.3333),
|
||||
"times": PackedFloat32Array(0, 0.0833333, 0.333333),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [true, false, true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("SwordSlashAnimation:frame")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666667, 0.75, 0.833333, 0.916666),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_uxo8q"]
|
||||
resource_name = "explosion"
|
||||
length = 3.66668
|
||||
step = 0.0833333
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_w8l8m"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_hcjph"),
|
||||
"attack": SubResource("Animation_0jjwv")
|
||||
"attack": SubResource("Animation_0jjwv"),
|
||||
"explosion": SubResource("Animation_uxo8q")
|
||||
}
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_irupf"]
|
||||
atlas = ExtResource("6_p34sl")
|
||||
region = Rect2(300, 0, 300, 300)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_63m7j"]
|
||||
atlas = ExtResource("6_p34sl")
|
||||
region = Rect2(600, 0, 300, 300)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1ypgu"]
|
||||
atlas = ExtResource("6_p34sl")
|
||||
region = Rect2(900, 0, 300, 300)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_d7qd7"]
|
||||
atlas = ExtResource("6_p34sl")
|
||||
region = Rect2(1200, 0, 300, 300)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7heog"]
|
||||
atlas = ExtResource("6_p34sl")
|
||||
region = Rect2(1500, 0, 300, 300)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_x4mbv"]
|
||||
atlas = ExtResource("6_p34sl")
|
||||
region = Rect2(1800, 0, 300, 300)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f7ysd"]
|
||||
atlas = ExtResource("6_p34sl")
|
||||
region = Rect2(2100, 0, 300, 300)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_i2p57"]
|
||||
atlas = ExtResource("6_p34sl")
|
||||
region = Rect2(2400, 0, 300, 300)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tfnlg"]
|
||||
atlas = ExtResource("6_p34sl")
|
||||
region = Rect2(2700, 0, 300, 300)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gvgtb"]
|
||||
atlas = ExtResource("6_p34sl")
|
||||
region = Rect2(3000, 0, 300, 300)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fha34"]
|
||||
atlas = ExtResource("5_wr6lo")
|
||||
region = Rect2(0, 0, 450, 450)
|
||||
@@ -155,6 +227,47 @@ region = Rect2(1800, 450, 450, 450)
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": null
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_irupf")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_63m7j")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1ypgu")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_d7qd7")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_7heog")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_x4mbv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_f7ysd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_i2p57")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tfnlg")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gvgtb")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": null
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"attack",
|
||||
"speed": 12.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_fha34")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
@@ -218,7 +331,12 @@ animations = [{
|
||||
"texture": null
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"attack",
|
||||
"name": &"attack_fire",
|
||||
"speed": 12.0
|
||||
}, {
|
||||
"frames": [],
|
||||
"loop": true,
|
||||
"name": &"attack_water",
|
||||
"speed": 12.0
|
||||
}]
|
||||
|
||||
@@ -281,7 +399,9 @@ visible = false
|
||||
[node name="SwordSlashAnimation" type="AnimatedSprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
texture_filter = 1
|
||||
position = Vector2(900, 565)
|
||||
scale = Vector2(1.8, 1.8)
|
||||
position = Vector2(983, 555)
|
||||
scale = Vector2(3, 3)
|
||||
sprite_frames = SubResource("SpriteFrames_ywvvo")
|
||||
animation = &"attack"
|
||||
flip_h = true
|
||||
flip_v = true
|
||||
|
||||
Reference in New Issue
Block a user