diff --git a/assets/audio/sfx/pop.mp3 b/assets/audio/sfx/pop.mp3 new file mode 100644 index 0000000..1a22981 Binary files /dev/null and b/assets/audio/sfx/pop.mp3 differ diff --git a/assets/audio/sfx/pop.mp3.import b/assets/audio/sfx/pop.mp3.import new file mode 100644 index 0000000..c6204ca --- /dev/null +++ b/assets/audio/sfx/pop.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://dp6k7xiptn68n" +path="res://.godot/imported/pop.mp3-51a070d5fcfecbb5cfeda8302a6c6eb8.mp3str" + +[deps] + +source_file="res://assets/audio/sfx/pop.mp3" +dest_files=["res://.godot/imported/pop.mp3-51a070d5fcfecbb5cfeda8302a6c6eb8.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/audio/sfx/slap.mp3 b/assets/audio/sfx/slap.mp3 new file mode 100644 index 0000000..5972c53 Binary files /dev/null and b/assets/audio/sfx/slap.mp3 differ diff --git a/assets/audio/sfx/slap.mp3.import b/assets/audio/sfx/slap.mp3.import new file mode 100644 index 0000000..cf96d9e --- /dev/null +++ b/assets/audio/sfx/slap.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://xoy5ct1t17k5" +path="res://.godot/imported/slap.mp3-1d1643f76cf53c654c25725ee203e7cf.mp3str" + +[deps] + +source_file="res://assets/audio/sfx/slap.mp3" +dest_files=["res://.godot/imported/slap.mp3-1d1643f76cf53c654c25725ee203e7cf.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/audio/sfx/spikeweed_attack.mp3 b/assets/audio/sfx/spikeweed_attack.mp3 new file mode 100644 index 0000000..07f9a6c Binary files /dev/null and b/assets/audio/sfx/spikeweed_attack.mp3 differ diff --git a/assets/audio/sfx/spikeweed_attack.mp3.import b/assets/audio/sfx/spikeweed_attack.mp3.import new file mode 100644 index 0000000..d48d1b8 --- /dev/null +++ b/assets/audio/sfx/spikeweed_attack.mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://ypihbxy7tsqn" +path="res://.godot/imported/spikeweed_attack.mp3-927978b1d538113780c1cca743c69286.mp3str" + +[deps] + +source_file="res://assets/audio/sfx/spikeweed_attack.mp3" +dest_files=["res://.godot/imported/spikeweed_attack.mp3-927978b1d538113780c1cca743c69286.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/default_bus_layout.tres b/default_bus_layout.tres new file mode 100644 index 0000000..9473b3a --- /dev/null +++ b/default_bus_layout.tres @@ -0,0 +1,9 @@ +[gd_resource type="AudioBusLayout" format=3 uid="uid://igejanqt2yqf"] + +[resource] +bus/1/name = &"MusicBus" +bus/1/solo = false +bus/1/mute = false +bus/1/bypass_fx = false +bus/1/volume_db = 0.0 +bus/1/send = &"Master" diff --git a/resources/animations/plants/peashooter.res b/resources/animations/plants/peashooter.res index baca3ba..4040694 100644 Binary files a/resources/animations/plants/peashooter.res and b/resources/animations/plants/peashooter.res differ diff --git a/scenes/entities/Zombies/zombie.tscn b/scenes/entities/Zombies/zombie.tscn index 3d34969..c26b14e 100644 --- a/scenes/entities/Zombies/zombie.tscn +++ b/scenes/entities/Zombies/zombie.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=26 format=3 uid="uid://co11v3w8hbwgf"] +[gd_scene load_steps=28 format=3 uid="uid://co11v3w8hbwgf"] [ext_resource type="Script" path="res://scripts/components/zombies/RuntimeZombieData.cs" id="1_qq3f1"] [ext_resource type="Texture2D" uid="uid://bwwbkybryi6k0" path="res://assets/sprites/zombie.tres" id="2_4pdxh"] @@ -7,6 +7,8 @@ [ext_resource type="Script" path="res://scripts/components/FlashComponent.cs" id="3_rao3m"] [ext_resource type="Script" path="res://scripts/components/zombies/ZombieMover.cs" id="4_u5syx"] [ext_resource type="Script" path="res://scripts/components/zombies/behaviours/BasicZombieBehaviour.cs" id="5_2pvkr"] +[ext_resource type="AudioStream" uid="uid://xoy5ct1t17k5" path="res://assets/audio/sfx/slap.mp3" id="8_di4dd"] +[ext_resource type="Script" path="res://scripts/components/zombies/AudioDamage.cs" id="9_oxd1e"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_63ls2"] resource_local_to_scene = true @@ -206,6 +208,11 @@ script = ExtResource("5_2pvkr") [node name="Node" type="Node" parent="."] +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource("8_di4dd") +script = ExtResource("9_oxd1e") + [connection signal="OnHPChanged" from="." to="CanvasGroup" method="DamageFlash"] +[connection signal="OnHPChanged" from="." to="AudioStreamPlayer2D" method="OnHPChanged"] [connection signal="area_entered" from="Eatbox" to="Eatbox" method="OnAreaEntered"] [connection signal="area_exited" from="Eatbox" to="Eatbox" method="OnAreaExited"] diff --git a/scenes/entities/plants/peashooter.tscn b/scenes/entities/plants/peashooter.tscn index 36968c8..8a3e0cc 100644 --- a/scenes/entities/plants/peashooter.tscn +++ b/scenes/entities/plants/peashooter.tscn @@ -115,5 +115,8 @@ script = ExtResource("7_fdkt2") shape = SubResource("SegmentShape2D_v570y") script = ExtResource("6_0812i") +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] +max_polyphony = 2 + [connection signal="area_entered" from="Eyesight" to="Eyesight" method="OnAreaEntered"] [connection signal="area_exited" from="Eyesight" to="Eyesight" method="OnAreaExited"] diff --git a/scenes/entities/plants/spikeweed.tscn b/scenes/entities/plants/spikeweed.tscn index aa22889..fa21ed0 100644 --- a/scenes/entities/plants/spikeweed.tscn +++ b/scenes/entities/plants/spikeweed.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=10 format=3 uid="uid://bdhod5c6o53ha"] +[gd_scene load_steps=11 format=3 uid="uid://bdhod5c6o53ha"] [ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/entities/plants/plant_template.tscn" id="1_vmbvr"] [ext_resource type="Texture2D" uid="uid://coafh3mjharxo" path="res://assets/sprites/atlases/plants/spikeweed.png" id="2_ffrjr"] +[ext_resource type="AudioStream" uid="uid://ypihbxy7tsqn" path="res://assets/audio/sfx/spikeweed_attack.mp3" id="3_5wcts"] [ext_resource type="Script" path="res://scripts/components/plants/AreaAttack.cs" id="3_hqtbm"] [ext_resource type="Script" path="res://scripts/components/plants/behaviours/SpikeweedBehaviour.cs" id="3_uhpn7"] @@ -51,6 +52,21 @@ tracks/1/keys = { "method": &"Attack" }] } +tracks/2/type = "audio" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("AudioStreamPlayer2D") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("3_5wcts") +}], +"times": PackedFloat32Array(0.166667) +} +tracks/2/use_blend = true [sub_resource type="Animation" id="Animation_h2f35"] resource_name = "idle" @@ -107,5 +123,7 @@ shape = SubResource("RectangleShape2D_1di76") script = ExtResource("3_uhpn7") _player = NodePath("../AnimationPlayer") +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="." index="4"] + [connection signal="area_entered" from="Hitbox" to="Behaviour" method="OnHitboxEntered"] [connection signal="area_exited" from="Hitbox" to="Behaviour" method="OnHitboxExited"] diff --git a/scripts/components/zombies/AudioDamage.cs b/scripts/components/zombies/AudioDamage.cs new file mode 100644 index 0000000..da814e7 --- /dev/null +++ b/scripts/components/zombies/AudioDamage.cs @@ -0,0 +1,10 @@ +using Godot; +using System; + +public partial class AudioDamage : AudioStreamPlayer2D +{ + public void OnHPChanged(int amount) + { + Play(); + } +} diff --git a/scripts/components/zombies/RuntimeZombieData.cs b/scripts/components/zombies/RuntimeZombieData.cs index d566d74..5aacc3d 100644 --- a/scripts/components/zombies/RuntimeZombieData.cs +++ b/scripts/components/zombies/RuntimeZombieData.cs @@ -41,7 +41,6 @@ public partial class RuntimeZombieData : Node2D, IEntity if (_hp <= 0) { QueueFree(); - } } }