You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
423 B
20 lines
423 B
4 years ago
|
extends Label
|
||
|
|
||
|
var hiscore
|
||
|
var numOfCoins
|
||
|
|
||
|
func load_game():
|
||
|
var save_game = File.new()
|
||
|
if not save_game.file_exists("user://savegame.save"):
|
||
|
return
|
||
|
save_game.open("user://savegame.save", File.READ)
|
||
|
while save_game.get_position() < save_game.get_len():
|
||
|
var data = parse_json(save_game.get_line())
|
||
|
hiscore = data["hiscore"]
|
||
|
numOfCoins = data["numOfCoins"]
|
||
|
|
||
|
func _ready():
|
||
|
load_game()
|
||
|
text = str(numOfCoins)
|
||
|
|