Saving settings

Saving settings

We’ve added three toggle properties in the game - which works fine - but the settings aren’t preserved when we quit. We need to save those settings so the next time you run the game, they persist.

First, we’ll define our settings file in res://

var settings_file = "user://"

Next, we’ll add saving/loading functions for the three game settings that we want to save.

func save_settings():
    var f =, File.WRITE)

func load_settings():
    var f =
    if f.file_exists(settings_file):, File.READ)
        enable_sound = f.get_var()
        enable_music = f.get_var()
        self.enable_ads = f.get_var()

Call load_settings() in _ready() and save_settings() at the end of set_enable_ads(). Also, in we need to save the state when the sound/music settings change, so add settings.save_settings() in each of those parts of the match statement.

Another problem we’ll have is when the game starts, the icons in the settings menu won’t reflect the state that we just loaded from the save file. We can set that in register_buttons() which is already looping through all buttons to connect their signals:

for button in buttons:
    button.connect("pressed", self, "_on_button_pressed", [button])
            if settings.enable_ads:
                button.text = "Disable Ads"
                button.text = "Enable Ads"
            button.texture_normal = sound_buttons[settings.enable_sound]
            button.texture_normal = music_buttons[settings.enable_music]

About screen

The other thing we’ll add in this part is an “About” screen. This is where we’ll let the player know what the game’s all about and link to its license and to this page, since it is a tutorial game.


Complying with license terms is very important. You can find out what’s required by Godot here: Complying with Licenses. Note that the art you’re using may also require credit, links, or other acknowledgement.

To reach it, we’ve added a new button on the “Title” screen:

alt alt

The button is setup just like the others - add it to the “buttons” group so that it will get registered. In the, add another match for this button’s name:


Here’s what the “About” screen looks like:

alt alt

Extending “BaseScreen.tscn”, we’ve added a TextEdit and another container for a single “Home” button.

In the TextEdit, set BBCode enabled and put the following in the Text property:

[center][u]Circle Jump[/u]


Circle Jump is an open source tutorial game made with the Godot Game Engine. You can find the tutorial and the game's source code here:

[url=]Circle Jump Source[/url]

Copyright © 2019 KidsCanCode

[url=]License Information[/url]

See BBCode in RichTextLabel for details on how BBCode formatting works.

To allow clicking on URLs, connect the meta_clicked signal of the TextEdit:

func _on_TextEdit_meta_clicked(meta):

Follow this project on Github:

Do you prefer video?