Skip to content

Commit

Permalink
Merge pull request #7 from 2nafish117/scene-path-fix
Browse files Browse the repository at this point in the history
Fix Scene Path and minor warnings
  • Loading branch information
bitbrain authored Jan 24, 2024
2 parents 38d1773 + b284aa7 commit 5667a7c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions godot/savegame/save_game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ static func save_game(tree:SceneTree):

print("Saving game to user://" + SAVE_GAME_TEMPLATE)

var save_game = null
var save_file = null

if OS.is_debug_build():
save_game = FileAccess.open("user://" + SAVE_GAME_TEMPLATE, FileAccess.WRITE)
save_file = FileAccess.open("user://" + SAVE_GAME_TEMPLATE, FileAccess.WRITE)
else:
save_game = FileAccess.open_encrypted_with_pass("user://" + SAVE_GAME_TEMPLATE, FileAccess.WRITE, ENCRYPTION_KEY)
save_file = FileAccess.open_encrypted_with_pass("user://" + SAVE_GAME_TEMPLATE, FileAccess.WRITE, ENCRYPTION_KEY)

var save_nodes = tree.get_nodes_in_group(SAVE_GROUP_NAME)

Expand Down Expand Up @@ -79,7 +79,7 @@ static func save_game(tree:SceneTree):
save_data["node_data"] = node.call("save_data")

# Store the save dictionary as a new line in the save file.
save_game.store_line(JSON.new().stringify(save_data))
save_file.store_line(JSON.stringify(save_data))

static func load_game(tree:SceneTree) -> void:

Expand All @@ -101,17 +101,17 @@ static func load_game(tree:SceneTree) -> void:

# Load the file line by line and process that dictionary to restore
# the object it represents.
var save_game = null
var save_file = null

if OS.is_debug_build():
save_game = FileAccess.open("user://" + SAVE_GAME_TEMPLATE, FileAccess.READ)
save_file = FileAccess.open("user://" + SAVE_GAME_TEMPLATE, FileAccess.READ)
else:
save_game = FileAccess.open_encrypted_with_pass("user://" + SAVE_GAME_TEMPLATE, FileAccess.READ, ENCRYPTION_KEY)
save_file = FileAccess.open_encrypted_with_pass("user://" + SAVE_GAME_TEMPLATE, FileAccess.READ, ENCRYPTION_KEY)

while save_game.get_position() < save_game.get_length():
while save_file.get_position() < save_file.get_length():
# Get the saved dictionary from the next line in the save file
var test_json_conv = JSON.new()
test_json_conv.parse(save_game.get_line())
test_json_conv.parse(save_file.get_line())
var save_data = test_json_conv.get_data()

# Firstly, we need to create the object and add it to the tree and set its position.
Expand Down
2 changes: 1 addition & 1 deletion godot/scenes/boot/bootsplash_scene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func _ready():
.from(0.0)\
.finished.connect(_fade_out)

func _process(delta):
func _process(_delta):
if interuptable and Input.is_action_just_pressed("exit"):
_change_scene()

Expand Down
2 changes: 1 addition & 1 deletion godot/scenes/game_settings_scene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func _ready():
return_button.grab_focus()

func _on_fade_overlay_on_complete_fade_out():
get_tree().change_scene_to_file("res://scenes/MainMenuScene.tscn")
get_tree().change_scene_to_file("res://scenes/main_menu_scene.tscn")

func _on_return_button_pressed():
overlay.fade_out()
4 changes: 2 additions & 2 deletions godot/ui/components/float_range_game_settings_option.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var initialised = false
func _ready():
value = UserSettings.get_value(property)

func _on_float_range_game_settings_option_value_changed(value):
func _on_float_range_game_settings_option_value_changed(val):
if !initialised:
initialised = true
UserSettings.set_value(property, value)
UserSettings.set_value(property, val)

0 comments on commit 5667a7c

Please sign in to comment.