death anim & fixed stuff

godot-4.1.1
HumanoidSandvichDispenser 2023-07-24 00:30:33 -07:00
parent 6416ab3f55
commit 3f4567b6ba
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
10 changed files with 168 additions and 19 deletions

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bbqdpexvknma2"
path="res://.godot/imported/never-lucky.mp3-e798b8414991df1e214d65da89b6244b.mp3str"
[deps]
source_file="res://Assets/Sounds/never-lucky.mp3"
dest_files=["res://.godot/imported/never-lucky.mp3-e798b8414991df1e214d65da89b6244b.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,43 @@
[gd_resource type="ParticleProcessMaterial" load_steps=7 format=3 uid="uid://ra02tvwd5o5g"]
[sub_resource type="Gradient" id="Gradient_6k7fi"]
offsets = PackedFloat32Array(0, 0.540741, 0.592593, 1)
colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_1phkb"]
gradient = SubResource("Gradient_6k7fi")
[sub_resource type="Gradient" id="Gradient_3tax5"]
offsets = PackedFloat32Array(0, 0.533333, 1)
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_13jjx"]
gradient = SubResource("Gradient_3tax5")
[sub_resource type="Curve" id="Curve_0565g"]
_data = [Vector2(0, 0.5), 0.0, 5.0, 0, 1, Vector2(0.1, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), -1.11111, 0.0, 1, 0]
point_count = 3
[sub_resource type="CurveTexture" id="CurveTexture_k4txv"]
curve = SubResource("Curve_0565g")
[resource]
emission_shape = 2
emission_sphere_radius = 8.0
particle_flag_disable_z = true
direction = Vector3(0, -1, 0)
spread = 90.0
gravity = Vector3(0, 0, 0)
initial_velocity_min = 128.0
initial_velocity_max = 256.0
orbit_velocity_min = 0.0
orbit_velocity_max = 0.0
tangential_accel_min = -16.0
tangential_accel_max = 16.0
scale_min = 0.25
scale_max = 0.25
scale_curve = SubResource("CurveTexture_k4txv")
color_ramp = SubResource("GradientTexture1D_13jjx")
color_initial_ramp = SubResource("GradientTexture1D_1phkb")
turbulence_enabled = true
turbulence_noise_scale = 4.0

View File

@ -253,15 +253,12 @@ public partial class Character : CharacterBody2D, IFaction
ApplyImpulse(knockbackDir.Normalized() * knockback);
GD.Print("lol");
// play damage animation
var anim = GetNode<AnimationPlayer>("Animations/Hurt");
if (anim != null)
if (HurtAnimation is not null && Health > 0)
{
anim.Stop();
anim.Play("hurt");
anim.Queue("hurt_flash");
HurtAnimation.Stop();
HurtAnimation.Play("hurt");
HurtAnimation.Queue("hurt_flash");
}
// if anyone involved is a player, shake their screen

View File

@ -54,6 +54,10 @@ tracks/0/keys = {
"values": [0]
}
[sub_resource type="Animation" id="Animation_j0d8o"]
resource_name = "dash"
length = 0.1
[sub_resource type="Animation" id="Animation_px7yx"]
resource_name = "idle"
length = 0.5
@ -88,10 +92,6 @@ tracks/0/keys = {
"values": [2, 3, 4, 5, 6, 7]
}
[sub_resource type="Animation" id="Animation_j0d8o"]
resource_name = "dash"
length = 0.1
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1xv7m"]
_data = {
"RESET": SubResource("Animation_7ay6e"),

View File

@ -26,8 +26,10 @@ public sealed partial class Player : Character
public override void _Ready()
{
InteractionRay = GetNode<InteractionRay>("Direction2D/InteractionRay");
Death += (Events.HealthChangedArgs args) =>
Death += async (Events.HealthChangedArgs args) =>
{
HurtAnimation.Play("death");
await ToSignal(HurtAnimation, "animation_finished");
Visible = false;
};

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=55 format=3 uid="uid://b2254pup8k161"]
[gd_scene load_steps=58 format=3 uid="uid://b2254pup8k161"]
[ext_resource type="Script" path="res://Characters/Player.cs" id="1_flygr"]
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_ngsgt"]
@ -15,6 +15,8 @@
[ext_resource type="Material" uid="uid://x5qcq5muvc3g" path="res://Assets/Sprites/Particles/PlayerDamageProcessMaterial.tres" id="8_yf112"]
[ext_resource type="Texture2D" uid="uid://c1a7lvb4uuwfy" path="res://Assets/Sprites/Particles/circle-16.png" id="9_7gumm"]
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="9_avyu4"]
[ext_resource type="Material" uid="uid://ra02tvwd5o5g" path="res://Assets/Sprites/Particles/PlayerDeathProcessMaterial.tres" id="10_agw51"]
[ext_resource type="AudioStream" uid="uid://bbqdpexvknma2" path="res://Assets/Sounds/never-lucky.mp3" id="12_vd7j4"]
[ext_resource type="AudioStream" uid="uid://bkeyg8weaqnuu" path="res://Assets/Sounds/splat-player.ogg" id="12_vvem5"]
[ext_resource type="Script" path="res://BoundingBoxes/InteractionRay.cs" id="13_hs3u1"]
[ext_resource type="PackedScene" uid="uid://p7oijq6dbvvk" path="res://Items/Weapons/DocLance.tscn" id="14_bj0lo"]
@ -205,6 +207,30 @@ tracks/2/keys = {
"update": 1,
"values": [false]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath(".:material:shader_parameter/alpha_modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [1.0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Effects/DeathParticles:emitting")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_dxevc"]
resource_name = "hurt"
@ -278,9 +304,64 @@ tracks/0/keys = {
"values": [0.0, 1.0, 0.0]
}
[sub_resource type="Animation" id="Animation_vtf8v"]
resource_name = "death"
length = 3.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprites/Node2D/Character:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [11, 15, 16, 17]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Effects/DeathParticles:emitting")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(1),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".:material:shader_parameter/alpha_modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(1, 1.2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.0]
}
tracks/3/type = "method"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Effects/DeathCry")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0.3),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [0.0],
"method": &"play"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_xe5eq"]
_data = {
"RESET": SubResource("Animation_k6l16"),
"death": SubResource("Animation_vtf8v"),
"hurt": SubResource("Animation_dxevc"),
"hurt_flash": SubResource("Animation_pjey7")
}
@ -451,7 +532,7 @@ lifetime = 0.8
[node name="DeathParticles" type="GPUParticles2D" parent="Effects"]
emitting = false
amount = 32
process_material = ExtResource("8_yf112")
process_material = ExtResource("10_agw51")
texture = SubResource("CanvasTexture_pited")
lifetime = 2.0
preprocess = 0.1
@ -467,6 +548,10 @@ one_shot = true
preprocess = 0.1
explosiveness = 0.9
[node name="DeathCry" type="AudioStreamPlayer2D" parent="Effects"]
stream = ExtResource("12_vd7j4")
volume_db = 2.0
[node name="Camera2D" parent="." instance=ExtResource("4_ym125")]
limit_left = -256
limit_top = -256
@ -480,13 +565,14 @@ use_parent_material = true
rotation = 6.28319
[node name="Node2D" type="Node2D" parent="Sprites"]
use_parent_material = true
[node name="Character" type="Sprite2D" parent="Sprites/Node2D"]
use_parent_material = true
position = Vector2(-1, -8)
position = Vector2(0, -8)
texture = ExtResource("4_5vird")
offset = Vector2(0, -4)
hframes = 24
hframes = 18
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -4)

View File

@ -6,13 +6,14 @@
[ext_resource type="Script" path="res://UI/UIController.cs" id="3_fe62s"]
[ext_resource type="PackedScene" uid="uid://01d24ij5av1y" path="res://UI/BossBar.tscn" id="5_8njq4"]
[node name="World" type="Node2D"]
[node name="World" type="Node2D" node_paths=PackedStringArray("UIController")]
script = ExtResource("1_1k6ew")
StartingArea = ExtResource("2_avsrq")
UIController = NodePath("CanvasLayer/UI")
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="UI" type="Control" parent="CanvasLayer"]
[node name="UI" type="Control" parent="CanvasLayer" node_paths=PackedStringArray("BossBar")]
z_index = 128
layout_mode = 3
anchors_preset = 15
@ -23,6 +24,7 @@ grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource("3_fe62s")
BossBar = NodePath("Bottom/BossBar")
[node name="Top" type="HBoxContainer" parent="CanvasLayer/UI"]
layout_mode = 1
@ -41,7 +43,6 @@ layout_mode = 2
size_flags_horizontal = 3
[node name="Bottom" type="HBoxContainer" parent="CanvasLayer/UI"]
visible = false
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
@ -53,4 +54,5 @@ grow_vertical = 0
alignment = 1
[node name="BossBar" parent="CanvasLayer/UI/Bottom" instance=ExtResource("5_8njq4")]
visible = false
layout_mode = 2