From 599117a23af5e58ff76a1c800149222d86057031 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Sun, 8 Oct 2023 18:56:56 -0400 Subject: [PATCH] make menu sounds chromatic unless you go enough times --- objects/hud/menu_sounds.gd | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/objects/hud/menu_sounds.gd b/objects/hud/menu_sounds.gd index ce3a479..faf2115 100644 --- a/objects/hud/menu_sounds.gd +++ b/objects/hud/menu_sounds.gd @@ -1,18 +1,24 @@ extends Node const SEMITONE := 1.05946 +const CHROMATIC := [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0] const RUMBLE := [0.0, 0.0, 5.0, 7.0, 10.0, 0.0, 5.0, 7.0, 10.0, 7.0] var can_play: bool = false var current_note: int = 0 +var notes_till_rumble: int = 48 onready var select_sound: AudioStreamPlayer = $"%SelectSound" func play_select_sound(): if can_play: - select_sound.pitch_scale = pow(SEMITONE, RUMBLE[current_note]) - current_note = posmod(current_note + 1, RUMBLE.size()) + var tune = CHROMATIC if notes_till_rumble > 0 else RUMBLE + if notes_till_rumble == 0: + current_note = 0 + select_sound.pitch_scale = pow(SEMITONE, tune[current_note]) select_sound.play() + current_note = posmod(current_note + 1, tune.size()) + notes_till_rumble -= 1 else: can_play = true