Topic was automatically imported from the old Question2Answer platform.
Asked By
damianus
Hello every one,
i have an array with 4 texts in it and i want to print each of them once at time with spacebar… i tryed to use for cycle but it seems to print all the array at once… thank you for your help
var index = 0
var array = ["text1", "text2", "text3", "text4"]
func _process(delta):
if Input.is_action_just_pressed("ui_accept"):
print(array[index]) #or $Label.text = String(array[index]) if you have a label
index+=1
if index == 4:
index = 0 #reset to beginning