Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | lalel345 |
This code does not work for me to save an array, what am I doing wrong?
func _ready():
load_score()
func _physics_process(delta):
if Input.is_action_just_pressed("ui_accept"):
print(array[0])
print(array[1])
array[0] += 1
array[1] += 1
save_score()
func save_score():
var file = File.new()
file.open(score_file, File.WRITE)
file.store_var(array[0])
file.close()
func load_score():
var file = File.new()
file.open(score_file, File.READ)
array = file.get_as_text()
file.close()