fix sound

This commit is contained in:
Nikolay Fedorov
2026-04-23 19:05:10 +03:00
parent 1c70488ea5
commit 849b0b7315
5 changed files with 26 additions and 23 deletions
+3 -3
View File
@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://baeea1yfs0cnn"
path="res://.godot/imported/Tutorial_shield.jpeg-d9b563c9ca34dc1a19e82a0ec964c1b9.ctex"
path="res://.godot/imported/Tutorial_Shield.jpeg-6b96e6b9716aced42153397e827ce868.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Tutorial_shield.jpeg"
dest_files=["res://.godot/imported/Tutorial_shield.jpeg-d9b563c9ca34dc1a19e82a0ec964c1b9.ctex"]
source_file="res://assets/Tutorial_Shield.jpeg"
dest_files=["res://.godot/imported/Tutorial_Shield.jpeg-6b96e6b9716aced42153397e827ce868.ctex"]
[params]
+19
View File
@@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://boyy2vpjoxb6l"
path="res://.godot/imported/ambient.ogg-35a37efc4b30706a227e17f0453e3a99.oggvorbisstr"
[deps]
source_file="res://assets/ambient.ogg"
dest_files=["res://.godot/imported/ambient.ogg-35a37efc4b30706a227e17f0453e3a99.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
-19
View File
@@ -1,19 +0,0 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://boyy2vpjoxb6l"
path="res://.godot/imported/embient.ogg-00ba3a3987abe1f685c6b6795345f522.oggvorbisstr"
[deps]
source_file="res://assets/embient.ogg"
dest_files=["res://.godot/imported/embient.ogg-00ba3a3987abe1f685c6b6795345f522.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
+4 -1
View File
@@ -7,7 +7,7 @@ class_name SFX
# damage.ogg — player takes damage
# ambient.ogg — looping background ambience
const _BASE := "res://assets/sfx/"
const _BASE := "res://assets/"
static func _play(name: String, parent: Node, volume_db: float = 0.0, pitch: float = 1.0) -> void:
var path := _BASE + name
@@ -16,6 +16,9 @@ static func _play(name: String, parent: Node, volume_db: float = 0.0, pitch: flo
var stream := load(path) as AudioStream
if stream == null:
return
var ogg = stream as AudioStreamOggVorbis
if ogg != null:
ogg.loop = false
var p := AudioStreamPlayer.new()
p.stream = stream
p.volume_db = volume_db