Simple 2D game based on avoiding asteroids while controlling a rocket
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.

32 lines
793 B

extends Node2D
var lastscore = 0
var hiscore = 0
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())
# lastscore = data["lastscore"]
hiscore = data["hiscore"]
func _ready():
load_game()
var ScoreLabel = Label.new()
add_child(ScoreLabel)
ScoreLabel.set_owner(get_tree().get_edited_scene_root())
var HiScoreLabel = Label.new()
add_child(HiScoreLabel)
HiScoreLabel.set_owner(get_tree().get_edited_scene_root())
ScoreLabel.text = str(lastscore)
HiScoreLabel.text = str(hiscore)
print(ScoreLabel.text)
print (HiScoreLabel.text)
print(HiScoreLabel.rect_position)