This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

Hi All. How do you keep the data which gets passed into variables during gameplay?
Say you have a level scene in which you collect points. There is a var in the scene's script that holds your score. Let's also assume that you get 2 turns on that level and the final score is a summary of both turns (like in ski jumping - you do 2 jumps on the same hill and the points from both get added up). The easiest way to start the 2nd turn is to reload the level at the end but when I do that, the score var gets cleared...

in Engine by (516 points)

1 Answer

0 votes
    func savedata(hs):
        var hs_old=load_data()
        if hs_old<hs:
            var data={

    func load_data():
        if file.file_exists(savePath):
            var dict = {}
            highscore = dict["highscore"]
            var data={
        return highscore

Have you been try to save your data to json file? Im using this for save and load highest score hope it can help, everytime player get higher score than before new highscore will replace it

by (48 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.