forked from team-sg/hero-mark-2
level select and save improvments
- level select starts on the stage you just came from - default time from save file is INF, so any actual time will get saved - INF renders as "-:--:--" to indicate a time has not been set
This commit is contained in:
parent
12825c3e61
commit
076a91b43b
3 changed files with 8 additions and 6 deletions
4
game.gd
4
game.gd
|
@ -100,11 +100,13 @@ func save():
|
||||||
|
|
||||||
#Convert seconds into M:SS:MS
|
#Convert seconds into M:SS:MS
|
||||||
func timeify(input):
|
func timeify(input):
|
||||||
|
if input < 600:
|
||||||
var minutes = str(floor(input / 60))
|
var minutes = str(floor(input / 60))
|
||||||
var seconds = floor(fmod(input,60))
|
var seconds = floor(fmod(input,60))
|
||||||
var milliseconds := floor(fmod(input, 1) * 100)
|
var milliseconds := floor(fmod(input, 1) * 100)
|
||||||
if input < 600:
|
|
||||||
return minutes + ":" + ("%02d" % seconds) + ":" + ("%02d" % milliseconds)
|
return minutes + ":" + ("%02d" % seconds) + ":" + ("%02d" % milliseconds)
|
||||||
|
elif input == INF:
|
||||||
|
return "-:--:--"
|
||||||
else:
|
else:
|
||||||
return "9:59:99"
|
return "9:59:99"
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ var current_shard = 0
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
change_current_level(0)
|
change_current_level(Game.current_level)
|
||||||
Game.ac_music.stop()
|
Game.ac_music.stop()
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
|
|
@ -15,10 +15,10 @@ func get_level_data(save_id):
|
||||||
return {
|
return {
|
||||||
# any% score and time
|
# any% score and time
|
||||||
score_any = file.get_value(save_id, "score_any", 0),
|
score_any = file.get_value(save_id, "score_any", 0),
|
||||||
time_any = file.get_value(save_id, "time_any", 0),
|
time_any = file.get_value(save_id, "time_any", INF),
|
||||||
# 100% score and time
|
# 100% score and time
|
||||||
score_100 = file.get_value(save_id, "score_100", 0),
|
score_100 = file.get_value(save_id, "score_100", 0),
|
||||||
time_100 = file.get_value(save_id, "time_100", 0),
|
time_100 = file.get_value(save_id, "time_100", INF),
|
||||||
shards = shards
|
shards = shards
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue