Hi, very-new-to-Godot-and-scripting here!
I'm making a 2D platformer.
Short version; I have some variable data in one scene that I want to transfer to another.
Upon winning the game (critia is to collect 3 coins) I change the scene from Level1.tscn to YouWin.tscn.
In Level1.tscn I have a label for counting how long it took to collect the 3 coins in minutes and seconds, and another label counting how many times the player died before getting the 3 coins.
When the player collects the 3rd coin and gets send to the YouWin.tscn, I would like to display the data from Level1.tscn on how much time was spend and how many times they died.
Just to be clear; I don't want to save this data or store it for some later purpose. I just want to show what it was for that run.
If possible I would like to convert the time (as it is current just text) to a numeric value so I can make some calculation of the score. Like for example the score will be 10,000 minus 'time spend' times 'number of deaths' or something like that.
This is not necessary at all though, so I'm fine with not being able to do it.
(It's just a small project to troll my friends a bit, in case you're wondering why I would make it so weird.)
I have been searching around for a bit and found something about making save/load files but I don't think that will work for me, since the game is going to be uploaded to itch.io. Honestly, I have no idea if this might work for running the game online as well...
I have also attempted some Global singleton things but I haven't managed to make them work as intended.
Here are my scripts;
(I'm a total newbie so these are amalgations of bits and pieces I have found YT tutorials and other QAs)
var coins = 0
var deaths = 0
$Coins.text = String(coins)
$Deaths.text = String(deaths)
coins = coins + 1
if coins == 3:
deaths = deaths + 1
coins = coins * 0
var time = 000
var timer_on = true
time += delta
var secs = fmod(time,60)
var mins = fmod(time, 60*60) / 60
var time_passed = "%02d : %02d" % [mins,secs]
text = time_passed
print(text) #print proves that the timer stoppes correctly on 'game_won'-signal