revo-jailbreak/menus/sound_select.gd
2023-07-24 19:21:04 -04:00

20 lines
612 B
GDScript

extends TextureButton
export (Array, String) var titles
export (Array, AudioStream) var sounds
var current_selection = 0
onready var body = $SoundLabel/Label
func _gui_input(event):
if Input.is_action_just_pressed("ui_left"):
current_selection -= 1
if Input.is_action_just_pressed("ui_right"):
current_selection += 1
if Input.is_action_just_pressed("ui_accept"):
Audio.play_sound(sounds[current_selection],Audio.ac_collectible)
if Input.is_action_just_pressed("ui_cancel"):
Audio.ac_music.stop()
current_selection = posmod(current_selection,sounds.size())
body.text = titles[current_selection]