Skip to content

Commit

Permalink
feat: clamp to a minimum pitch/scale_note
Browse files Browse the repository at this point in the history
Avoids some odd sounds on the lowest end. Sticking with the same
movement sound!
  • Loading branch information
russmatney committed Feb 21, 2024
1 parent cf72a58 commit 258c182
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Sounds.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum S {
showjumbotron,
step,
ui_dading,
dot_collected,
}

###########################################################################
Expand Down Expand Up @@ -41,6 +42,9 @@ enum S {
S.cure: [
preload("res://assets/sounds/Retro Game Weapons Sound Effects - cure.ogg")
],
S.dot_collected: [
preload("res://assets/sounds/Retro Game Weapons Sound Effects - cure.ogg"),
],
S.laser:
[
preload("res://assets/sounds/laser1.sfxr"),
Expand Down
4 changes: 3 additions & 1 deletion src/puzzle/PuzzleScene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,11 @@ func on_win():
func on_player_moved():
var total_dots = float(dot_count() + 1)
var dotted = total_dots - float(dot_count(true)) - 1
# ensure some minimum
dotted = clamp(dotted, total_dots/4, total_dots)
if state.win:
dotted += 1
Sounds.play(Sounds.S.cure, {scale_range=total_dots, scale_note=dotted})
Sounds.play(Sounds.S.dot_collected, {scale_range=total_dots, scale_note=dotted})

func on_player_undo():
Sounds.play(Sounds.S.minimize)
Expand Down

0 comments on commit 258c182

Please sign in to comment.