extends Node2D var playerAmount=2 var playerIndex=0 var objectName func _ready(): $"../characterViewer".hideGet() next() func next(): if playerIndex >= playerAmount: playerIndex = 0 objectName= "player%d" % playerIndex print(objectName) get_node(objectName).start() playerIndex += 1 func stats(): visible = false $"../characterViewer".visible = true get_node(objectName).stop() $"../back".disabled = false $"../back".visible = true $"../characterViewer/ScrollContainer/VBoxContainer".get_child(0).text = str(playerIndex-1) $"../characterViewer/ScrollContainer/VBoxContainer".get_child(0).editable = false $"../characterViewer"._on_button_pressed() func restart(): visible = true $"../characterViewer".visible = false get_node(objectName).start() $"../back".disabled = true $"../back".visible = false func _on_back_pressed(): restart()