Hi,
I'm trying to write data from my game to a txt file. Here's the example code:
func collect_data():
var data = "my data"
var file = File.new()
file.open("res://data.txt", File.WRITE)
file.seek_end()
file.store_string(data)
file.close()
This is essentially added to a button and activated when pressed, the button generates new data every time. Everything is working fine, I'm getting the data correct it's writing to file as well. The problem is whenever the button is pressed the current data overwrites the previous one.
I would like to keep all the data the button presses, but I can't figure out how to do that. I should mention that I'm using Godot to create a game for research purposes (PhD student) hence why I keep mentioning 'data' lol. The data is basically elements in the game state.