Fixed sound back to th way it was before mostly.
This commit is contained in:
+12
-4
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user