teststrecke-game/scripts/rounds_selection.gd

15 lines
351 B
GDScript

extends OptionButton
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var selectedRounds=Gamestate.getRounds()
select(selectedRounds-1) #preselect rounds
Gamestate.setRounds(selectedRounds)
func _on_item_selected(index: int) -> void:
Gamestate.setRounds(index+1)
print("Set rounds to "+str(index+1))