1
0
Fork 0

initial commit

This commit is contained in:
Booklordofthedings 2024-05-11 17:33:26 +02:00
commit bc6eb6f4a6
85 changed files with 2247 additions and 0 deletions

View file

@ -0,0 +1,24 @@
extends Node
var save_config : ConfigFile
## Initial load and parse
func _ready():
save_config = ConfigFile.new()
var err = save_config.load("user://save")
if err:
return
## Read a value with the given string key
func read(key : String, default : Variant):
return save_config.get_value("save", key, default)
## Write a key
func write(key : String, value : Variant):
save_config.set_value("save",key,value)
save_config.save("user://save")
## Reset the savefile
func reset():
save_config.clear()
save_config.save("user://save")

View file

@ -0,0 +1,34 @@
extends Node
var score : float = 0
var doScore : bool = false
var scoreMult = 0.5
func _ready():
var pi = get_node("/root/DataStore").read("coins", 0)
if pi:
scoreMult = 0.8
func barrel_destroyed():
if doScore:
score += 0.2
func start_scoring():
doScore = true
score = 0
func stop_scoring():
var coins = get_node("/root/DataStore").read("coins", 0)
coins += int(score)
get_node("/root/DataStore").write("coins", coins)
var highscore = get_node("/root/DataStore").read("highscore", 0)
if score < highscore:
get_node("/root/DataStore").write("highscore", score)
doScore = false
func _process(delta):
if doScore:
score = score + delta * scoreMult