diff --git a/bootclick.gd b/bootclick.gd index 5772473..bdc1966 100644 --- a/bootclick.gd +++ b/bootclick.gd @@ -2,11 +2,15 @@ extends Node var title = preload("res://title.tscn").instantiate() var boot = preload("res://bootclick.tscn").instantiate() +const loadgame = preload("res://load.gd") +const savegame = preload("res://save.gd") # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. + loadgame.new() + print(Global.level1max) + #pass # Replace with function body. #add_child(title) diff --git a/bootclick.tscn b/bootclick.tscn index c19b88d..1624031 100644 --- a/bootclick.tscn +++ b/bootclick.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=3 format=3 uid="uid://dyaorf0qpfokg"] +[gd_scene load_steps=3 format=3 uid="uid://lghjmhbmqoyt"] [ext_resource type="Script" path="res://bootclick.gd" id="1_52bti"] [ext_resource type="Script" path="res://fps.gd" id="2_gnh1w"] diff --git a/global.gd b/global.gd index 79b4ede..fec76d8 100644 --- a/global.gd +++ b/global.gd @@ -6,6 +6,14 @@ var origmpos var mousepos var timelimit = 15000 var wait +var hiscoresfile = "user://hiscores.save" +var level1max +var level2max +var level3max +var level4max +var level5max +var level6max +var level7max # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. diff --git a/levels/credits.tscn b/levels/credits.tscn index af26837..d6182c3 100644 --- a/levels/credits.tscn +++ b/levels/credits.tscn @@ -42,8 +42,7 @@ Pygame version testing Astroboy Zencifer Natasha -Sakura Nakayama -Bicycle Man +BMX Man Godot version testing @@ -455,7 +454,11 @@ Source code hosted at https://git.asgardius.company/asgardius/r3-cd You can listen the oficial radio station at https://asteroid.asgardius.company/public/r3 -Special Thanks for Unity Technologies for make me choosing Godot" +Special Thanks for Unity Technologies for make me choosing Godot + +Godot does what Unitydnt + +I'm looking for developers, artists and japanese voice actors who want to help on my next videogame from Asgardius Virtualx series" horizontal_alignment = 1 script = ExtResource("6_3q8sp") diff --git a/load.gd b/load.gd new file mode 100644 index 0000000..e034924 --- /dev/null +++ b/load.gd @@ -0,0 +1,36 @@ +extends Node +var file +func _init(): + if FileAccess.file_exists(Global.hiscoresfile): + file = FileAccess.open(Global.hiscoresfile, FileAccess.READ) + var checkpoint = file.get_as_text().rsplit(",", true, 7) + Global.level1max = checkpoint[0] + Global.level2max = checkpoint[1] + Global.level3max = checkpoint[2] + Global.level4max = checkpoint[3] + Global.level5max = checkpoint[4] + Global.level6max = checkpoint[5] + Global.level7max = checkpoint[6] + + # We need to revert the game state so we're not cloning objects + # during loading. This will vary wildly depending on the needs of a + # project, so take care with this step. + # For our example, we will accomplish this by deleting saveable objects. + #var save_nodes = get_tree().get_nodes_in_group("Persist") + #for i in save_nodes: + # i.queue_free() + + # Load the file line by line and process that dictionary to restore + # the object it represents. + else: + var saveinit = "9999999,9999999,9999999,9999999,9999999,9999999,9999999" + var file = FileAccess.open(Global.hiscoresfile, FileAccess.WRITE) + file.store_string(saveinit) + var checkpoint = saveinit.rsplit(",", true, 7) + Global.level1max = checkpoint[0] + Global.level2max = checkpoint[1] + Global.level3max = checkpoint[2] + Global.level4max = checkpoint[3] + Global.level5max = checkpoint[4] + Global.level6max = checkpoint[5] + Global.level7max = checkpoint[6] diff --git a/project.godot b/project.godot index 76eca5a..d3d30ef 100644 --- a/project.godot +++ b/project.godot @@ -24,7 +24,6 @@ Global="*res://global.gd" window/size/viewport_width=1280 window/size/viewport_height=720 -window/size/mode=3 window/stretch/mode="viewport" [rendering] diff --git a/save.gd b/save.gd new file mode 100644 index 0000000..a2789ff --- /dev/null +++ b/save.gd @@ -0,0 +1,6 @@ +extends Node +func _init(): + var saveinit = str(Global.level1max)+","+str(Global.level2max)+","+str(Global.level3max)+","+str(Global.level4max)+","+str(Global.level5max)+","+str(Global.level6max)+","+str(Global.level7max) + var file = FileAccess.open(Global.hiscoresfile, FileAccess.WRITE) + file.store_string(saveinit) + file.close()