sound feedback
parent
ef9da0d80b
commit
8e0f80c9d6
|
@ -207,7 +207,12 @@ namespace SupaLidlGame.Characters
|
|||
Player plr = inflictor as Player ?? this as Player;
|
||||
if (plr is not null)
|
||||
{
|
||||
plr.Camera.Shake(0.75f, 0.25f);
|
||||
plr.Camera.Shake(1, 0.4f);
|
||||
}
|
||||
|
||||
if (this.GetNode("HurtSound") is AudioStreamPlayer2D sound)
|
||||
{
|
||||
sound.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=24 format=3 uid="uid://ddcf6bfv212wj"]
|
||||
[gd_scene load_steps=25 format=3 uid="uid://ddcf6bfv212wj"]
|
||||
|
||||
[ext_resource type="Script" path="res://Characters/Enemy.cs" id="1_2yopk"]
|
||||
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="1_fx1w5"]
|
||||
|
@ -9,6 +9,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="6_jo0cg"]
|
||||
[ext_resource type="Script" path="res://Items/Inventory.cs" id="7_43gq8"]
|
||||
[ext_resource type="PackedScene" uid="uid://d72ehtv1ks0e" path="res://Items/Weapons/Sword.tscn" id="8_s3c8r"]
|
||||
[ext_resource type="AudioStream" uid="uid://njun3e6v4854" path="res://Assets/Sounds/hurt.wav" id="10_n1e64"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_8jbxb"]
|
||||
resource_local_to_scene = true
|
||||
|
@ -153,6 +154,9 @@ libraries = {
|
|||
"": SubResource("AnimationLibrary_xe5eq")
|
||||
}
|
||||
|
||||
[node name="HurtSound" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("10_n1e64")
|
||||
|
||||
[connection signal="ReceivedDamage" from="Hurtbox" to="." method="_on_hurtbox_received_damage"]
|
||||
|
||||
[editable path="Hurtbox"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=28 format=3 uid="uid://b2254pup8k161"]
|
||||
[gd_scene load_steps=29 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"]
|
||||
|
@ -11,6 +11,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://d72ehtv1ks0e" path="res://Items/Weapons/Sword.tscn" id="7_4rxuv"]
|
||||
[ext_resource type="Script" path="res://Items/Inventory.cs" id="7_xyenu"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="9_avyu4"]
|
||||
[ext_resource type="AudioStream" uid="uid://njun3e6v4854" path="res://Assets/Sounds/hurt.wav" id="12_h0x0g"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h78y7"]
|
||||
shader = ExtResource("2_ngsgt")
|
||||
|
@ -107,6 +108,10 @@ _data = {
|
|||
[sub_resource type="Environment" id="Environment_rs2vs"]
|
||||
background_mode = 3
|
||||
background_energy_multiplier = 16.0
|
||||
ambient_light_source = 3
|
||||
ambient_light_energy = 2.68
|
||||
glow_enabled = true
|
||||
glow_intensity = 8.0
|
||||
|
||||
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Camera", "Sprite", "Inventory", "StateMachine")]
|
||||
texture_filter = 3
|
||||
|
@ -144,21 +149,22 @@ DebugLevel = 2
|
|||
[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("MoveState", "IdleState")]
|
||||
script = ExtResource("4_4k4mb")
|
||||
MoveState = NodePath("../Move")
|
||||
IdleState = NodePath("")
|
||||
IdleState = NodePath(".")
|
||||
|
||||
[node name="Move" type="Node" parent="StateMachine" node_paths=PackedStringArray("RollState")]
|
||||
[node name="Move" type="Node" parent="StateMachine" node_paths=PackedStringArray("RollState", "IdleState")]
|
||||
script = ExtResource("5_tx5rw")
|
||||
RollState = NodePath("../Roll")
|
||||
IdleState = NodePath("../Idle")
|
||||
|
||||
[node name="Roll" type="Node" parent="StateMachine"]
|
||||
[node name="Roll" type="Node" parent="StateMachine" node_paths=PackedStringArray("IdleState")]
|
||||
script = ExtResource("6_6bgrj")
|
||||
IdleState = NodePath("../Idle")
|
||||
|
||||
[node name="Debug" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
|
||||
[node name="State" type="Label" parent="Debug"]
|
||||
layout_mode = 0
|
||||
offset_left = -20.0
|
||||
offset_top = -60.0
|
||||
offset_right = 20.0
|
||||
|
@ -190,6 +196,12 @@ libraries = {
|
|||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_rs2vs")
|
||||
|
||||
[node name="HurtSound" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("12_h0x0g")
|
||||
|
||||
[node name="AudioListener2D" type="AudioListener2D" parent="."]
|
||||
current = true
|
||||
|
||||
[connection signal="ReceivedDamage" from="Hurtbox" to="." method="_on_hurtbox_received_damage"]
|
||||
|
||||
[editable path="Hurtbox"]
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace SupaLidlGame.Items.Weapons
|
|||
// reset state of the weapon
|
||||
IsParried = false;
|
||||
IsParryable = true;
|
||||
ParryTimeOrigin = Time.GetTicksMsec();
|
||||
|
||||
AnimationPlayer.Stop();
|
||||
|
||||
|
@ -85,7 +86,6 @@ namespace SupaLidlGame.Items.Weapons
|
|||
|
||||
public void Attack()
|
||||
{
|
||||
ParryTimeOrigin = Time.GetTicksMsec();
|
||||
//RemainingAttackTime = AttackTime;
|
||||
IsAttacking = true;
|
||||
Hitbox.IsDisabled = false;
|
||||
|
@ -148,6 +148,7 @@ namespace SupaLidlGame.Items.Weapons
|
|||
IsParried = true;
|
||||
AnimationPlayer.PlaybackSpeed = 0.25f;
|
||||
Character.Stun(1.5f);
|
||||
GetNode<AudioStreamPlayer2D>("ParrySound").Play();
|
||||
}
|
||||
}
|
||||
//this.GetAncestor<TileMap>().AddChild(instance);
|
||||
|
@ -181,8 +182,6 @@ namespace SupaLidlGame.Items.Weapons
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//base._on_hitbox_hit(box);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=19 format=3 uid="uid://d72ehtv1ks0e"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://d72ehtv1ks0e"]
|
||||
|
||||
[ext_resource type="Script" path="res://Items/Weapons/Sword.cs" id="1_mlo73"]
|
||||
[ext_resource type="Texture2D" uid="uid://dt6u8p4h6g7le" path="res://Assets/Sprites/knife.png" id="2_rnfo4"]
|
||||
[ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="3_up3ob"]
|
||||
[ext_resource type="PackedScene" uid="uid://cojxmcin13ihm" path="res://Utils/Trail.tscn" id="4_pt6lq"]
|
||||
[ext_resource type="Texture2D" uid="uid://do1bui3bblkk7" path="res://Assets/Sprites/sword-swing.png" id="5_pywek"]
|
||||
[ext_resource type="AudioStream" uid="uid://c4n7ioxpukdwi" path="res://Assets/Sounds/parry.wav" id="6_8nxjm"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_jjxq2"]
|
||||
offsets = PackedFloat32Array(0, 0.945312)
|
||||
|
@ -364,6 +365,7 @@ hframes = 4
|
|||
[node name="SwingSound" type="AudioStreamPlayer2D" parent="."]
|
||||
|
||||
[node name="ParrySound" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("6_8nxjm")
|
||||
|
||||
[connection signal="Hit" from="Hitbox" to="." method="_on_hitbox_hit"]
|
||||
|
||||
|
|
Loading…
Reference in New Issue