Skip to content

Commit

Permalink
ball: make hit sound shorter and reduce concurrent sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed Jan 16, 2025
1 parent 9e14fad commit 1c9072d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Binary file modified game/assets/sounds/hit.ogg
Binary file not shown.
11 changes: 5 additions & 6 deletions game/src/actors/ball/HitSound.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

# SPDX-License-Identifier: AGPL-3.0-or-later

#helper for multiple audio stream playback
extends AudioStreamPlayer2D

const max_hits:int = 20
var hits:int = 0
const MAX_HITS: int = 4
var hits: int = 0

func hit(hit_speed:float) -> void:
func hit(hit_speed: float) -> void:
pitch_scale = rand_range(0.8, 1.2)
volume_db = hit_speed / 1000.0
volume_db = hit_speed / 1500.0
if !playing:
play()
elif hits < max_hits:
elif hits < MAX_HITS:
hits += 1
var audio_stream_player:AudioStreamPlayer2D = self.duplicate(DUPLICATE_USE_INSTANCING)
get_parent().add_child(audio_stream_player)
Expand Down

0 comments on commit 1c9072d

Please sign in to comment.