Fixed sound back to th way it was before mostly.

This commit is contained in:
Storm Dragon
2026-01-20 02:12:19 -05:00
parent 5a16f798ac
commit 385ed3fd9b
6 changed files with 51 additions and 29 deletions
+12 -4
View File
@@ -40,10 +40,18 @@ class Tree {
}
void update() {
// Keep tree sound active so distance-based fade can work.
// Only play tree sound if not chopped and within 3 tiles distance
if (!is_chopped) {
if (sound_handle == -1 || !p.sound_is_active(sound_handle)) {
sound_handle = play_1d_tile("sounds/environment/tree.ogg", x, position, true);
int tree_distance = x - position;
if (tree_distance < 0) tree_distance = -tree_distance;
if (tree_distance <= 3) {
if (sound_handle == -1 || !p.sound_is_active(sound_handle)) {
sound_handle = p.play_1d("sounds/environment/tree.ogg", x, position, true);
}
} else if (sound_handle != -1) {
p.destroy_sound(sound_handle);
sound_handle = -1;
}
} else if (sound_handle != -1) {
p.destroy_sound(sound_handle);
@@ -195,7 +203,7 @@ void damage_tree(int target_x, int damage) {
}
// Play the falling sound at the tree's position
play_1d_tile("sounds/items/tree.ogg", x, target.position, false);
p.play_1d("sounds/items/tree.ogg", x, target.position, false);
int sticks_dropped = random(1, 3);
int vines_dropped = random(1, 2);