make menu sounds chromatic unless you go enough times
This commit is contained in:
parent
899a985643
commit
599117a23a
1 changed files with 8 additions and 2 deletions
|
@ -1,18 +1,24 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
const SEMITONE := 1.05946
|
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]
|
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 can_play: bool = false
|
||||||
var current_note: int = 0
|
var current_note: int = 0
|
||||||
|
var notes_till_rumble: int = 48
|
||||||
|
|
||||||
onready var select_sound: AudioStreamPlayer = $"%SelectSound"
|
onready var select_sound: AudioStreamPlayer = $"%SelectSound"
|
||||||
|
|
||||||
func play_select_sound():
|
func play_select_sound():
|
||||||
if can_play:
|
if can_play:
|
||||||
select_sound.pitch_scale = pow(SEMITONE, RUMBLE[current_note])
|
var tune = CHROMATIC if notes_till_rumble > 0 else RUMBLE
|
||||||
current_note = posmod(current_note + 1, RUMBLE.size())
|
if notes_till_rumble == 0:
|
||||||
|
current_note = 0
|
||||||
|
select_sound.pitch_scale = pow(SEMITONE, tune[current_note])
|
||||||
select_sound.play()
|
select_sound.play()
|
||||||
|
current_note = posmod(current_note + 1, tune.size())
|
||||||
|
notes_till_rumble -= 1
|
||||||
else:
|
else:
|
||||||
can_play = true
|
can_play = true
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue