forked from team-sg/hero-mark-2
musical menu sounds :)
This commit is contained in:
parent
b4952da4d8
commit
298e31c5d5
1 changed files with 9 additions and 1 deletions
|
@ -1,10 +1,18 @@
|
|||
extends Node
|
||||
|
||||
const SEMITONE := 1.05946
|
||||
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
|
||||
|
||||
onready var select_sound: AudioStreamPlayer = $"%SelectSound"
|
||||
|
||||
func play_select_sound():
|
||||
if can_play:
|
||||
$"%SelectSound".play()
|
||||
select_sound.pitch_scale = pow(SEMITONE, RUMBLE[current_note])
|
||||
current_note = posmod(current_note + 1, RUMBLE.size())
|
||||
select_sound.play()
|
||||
else:
|
||||
can_play = true
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue