21 lines
577 B
GDScript
21 lines
577 B
GDScript
extends TextureButton
|
|
|
|
export (Array, String) var titles
|
|
export (Array, AudioStream) var songs
|
|
var current_selection = 0
|
|
onready var body = $MusicLabel/Label
|
|
|
|
func _ready():
|
|
call_deferred("grab_focus")
|
|
|
|
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(songs[current_selection],Audio.ac_music)
|
|
current_selection = posmod(current_selection,songs.size())
|
|
body.text = titles[current_selection]
|
|
|
|
|