feat: sound integration
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 8s
Create tag and build when new code gets to main / Export (push) Successful in 2m17s

This commit is contained in:
2025-08-03 12:41:19 +02:00
parent 130334d315
commit 49ede4a46b
12 changed files with 218 additions and 9 deletions

View File

@ -29,6 +29,14 @@ var has_shield = false
var has_sword = false
var has_armor = false
@onready var steps_player: AudioStreamPlayer = $StepsPlayer
@onready var gearup_armor: AudioStreamPlayer = $GearupArmor
@onready var gearup_sword: AudioStreamPlayer = $GearupSword
@onready var gearup_shield: AudioStreamPlayer = $GearupShield
@onready var sword_hit: AudioStreamPlayer = $SwordHit
@onready var got_hit_audio: AudioStreamPlayer = $GotHitAudio
func play_anim():
current_sprite.play(current_animation)
@ -115,6 +123,7 @@ func _physics_process(delta: float) -> void:
func hit():
is_hitting = true
sword_hit.play()
hitting.start()
hitbox.monitoring = true
@ -139,6 +148,7 @@ func _on_npc_shield_dialogue_dialogue_ended() -> void:
current_sprite.play("idle")
current_sprite.visible = true
has_shield = true
gearup_shield.play()
func _on_red_hood_sword_dialogue_dialogue_ended() -> void:
set_in_play()
@ -147,8 +157,10 @@ func _on_red_hood_sword_dialogue_dialogue_ended() -> void:
current_sprite.play("idle")
current_sprite.visible = true
has_sword = true
gearup_sword.play()
func _on_put_on_armor() -> void:
gearup_armor.play()
current_sprite.visible = false
current_sprite = armor
current_sprite.play("power_up")
@ -161,3 +173,15 @@ func _on_final_armor_dialogue_ended() -> void:
func _on_trigger_final_dialogue_body_entered(body: Node2D) -> void:
set_in_cutscene()
func _on_step_sound_interval_timeout() -> void:
if velocity.x == 0:
return
if not is_on_floor():
return
steps_player.play()
func _on_damageable_got_hit() -> void:
got_hit_audio.play()

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=79 format=3 uid="uid://yvp44oauis4n"]
[gd_scene load_steps=90 format=3 uid="uid://yvp44oauis4n"]
[ext_resource type="Script" uid="uid://c1fqj3lba7wik" path="res://player/player.gd" id="1_yw30f"]
[ext_resource type="Texture2D" uid="uid://cjruk5xlt3tyn" path="res://ennemy/MechantVol.png" id="2_ebec5"]
@ -13,6 +13,15 @@
[ext_resource type="Shape2D" uid="uid://6rhdwj5jxbxn" path="res://player/player_collision.tres" id="5_qjkh3"]
[ext_resource type="Texture2D" uid="uid://dw6tn0grt2ajc" path="res://player/assets/WalkCycle.png" id="10_yllr7"]
[ext_resource type="PackedScene" uid="uid://7sqwi3lygb1u" path="res://damageable/hitbox.tscn" id="11_2ieo8"]
[ext_resource type="AudioStream" uid="uid://cw85p1vga71gf" path="res://world_assets/audio/443275__loscolt890__regularfootstep001.wav" id="14_32hag"]
[ext_resource type="AudioStream" uid="uid://dui2a6u3ulit4" path="res://world_assets/audio/443279__loscolt890__regularfootstep003.wav" id="15_tqiix"]
[ext_resource type="AudioStream" uid="uid://b5r486lhi7jnj" path="res://world_assets/audio/443280__loscolt890__regularfootstep002.wav" id="16_e7oew"]
[ext_resource type="AudioStream" uid="uid://brkkvx06htfsi" path="res://world_assets/audio/gearuparmor.wav" id="17_c35mf"]
[ext_resource type="AudioStream" uid="uid://d2ic760ktymkc" path="res://world_assets/audio/gearupsword.wav" id="18_65viv"]
[ext_resource type="AudioStream" uid="uid://bx1m1b8l5j0cc" path="res://world_assets/audio/gearupshield.wav" id="19_x7c3f"]
[ext_resource type="AudioStream" uid="uid://k3nqsuybwrlf" path="res://world_assets/audio/swordhit2.wav" id="20_x7c3f"]
[ext_resource type="AudioStream" uid="uid://c4crs3etujcdo" path="res://world_assets/audio/swordhit.wav" id="21_bjvpn"]
[ext_resource type="AudioStream" uid="uid://cwnf4q8286apo" path="res://world_assets/audio/446013__slavicmagic__sword-hit.wav" id="22_bjvpn"]
[sub_resource type="AtlasTexture" id="AtlasTexture_3dxkp"]
atlas = ExtResource("2_ebec5")
@ -571,6 +580,17 @@ animations = [{
[sub_resource type="CircleShape2D" id="CircleShape2D_ebec5"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_c35mf"]
streams_count = 3
stream_0/stream = ExtResource("14_32hag")
stream_1/stream = ExtResource("15_tqiix")
stream_2/stream = ExtResource("16_e7oew")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_s7qer"]
streams_count = 2
stream_0/stream = ExtResource("20_x7c3f")
stream_1/stream = ExtResource("21_bjvpn")
[node name="Player" type="CharacterBody2D"]
collision_layer = 3
script = ExtResource("1_yw30f")
@ -630,4 +650,34 @@ damage = 10
position = Vector2(16, -10)
shape = SubResource("CircleShape2D_ebec5")
[node name="StepsPlayer" type="AudioStreamPlayer" parent="."]
stream = SubResource("AudioStreamRandomizer_c35mf")
bus = &"Steps"
[node name="GearupArmor" type="AudioStreamPlayer" parent="."]
stream = ExtResource("17_c35mf")
bus = &"Gearup"
[node name="GearupSword" type="AudioStreamPlayer" parent="."]
stream = ExtResource("18_65viv")
bus = &"Gearup"
[node name="GearupShield" type="AudioStreamPlayer" parent="."]
stream = ExtResource("19_x7c3f")
bus = &"Gearup"
[node name="SwordHit" type="AudioStreamPlayer" parent="."]
stream = SubResource("AudioStreamRandomizer_s7qer")
bus = &"SFX"
[node name="StepSoundInterval" type="Timer" parent="."]
wait_time = 0.5
autostart = true
[node name="GotHitAudio" type="AudioStreamPlayer" parent="."]
stream = ExtResource("22_bjvpn")
bus = &"SFX"
[connection signal="got_hit" from="Damageable" to="." method="_on_damageable_got_hit"]
[connection signal="timeout" from="Hitting" to="." method="_on_hitting_timeout"]
[connection signal="timeout" from="StepSoundInterval" to="." method="_on_step_sound_interval_timeout"]