forked from team-sg/hero-mark-2
add completion requirements and flag to level data and save
This commit is contained in:
parent
885082c7c4
commit
f263ce7842
6 changed files with 52 additions and 3 deletions
|
@ -194,6 +194,9 @@ func save():
|
|||
# set keys
|
||||
save_data.keys_collected = max(save_data.keys_collected, keys)
|
||||
|
||||
# mark as completed
|
||||
save_data.completed = true
|
||||
|
||||
# add to playtime
|
||||
Save.current_file.play_time += time
|
||||
|
||||
|
@ -201,6 +204,18 @@ func save():
|
|||
Save.current_file.save_to_file()
|
||||
|
||||
|
||||
# smaller save function for bosses
|
||||
func save_boss() -> void:
|
||||
var save_id = LevelData.levels[current_level].save_id
|
||||
var save_data: Save.LevelSaveData = Save.current_file.levels[save_id]
|
||||
|
||||
save_data.time_any = min(save_data.time_any, time)
|
||||
save_data.completed = true
|
||||
|
||||
Save.current_file.play_time += time
|
||||
Save.current_file.save_to_file()
|
||||
|
||||
|
||||
# !!DEPRECATED!! convert milliseconds into M:SS:MS
|
||||
func timeify(input):
|
||||
if input <= 5999099:
|
||||
|
|
|
@ -22,6 +22,8 @@ script = ExtResource( 5 )
|
|||
title = "Verdant Hills"
|
||||
shard_titles = [ "Climb to the top", "The obstacle course", "The smallest platform", "Energetic eviscerator", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "hills"
|
||||
shards_required = 0
|
||||
boss_required = ""
|
||||
boss = false
|
||||
scores_id = 13253
|
||||
times_id = 13255
|
||||
|
@ -33,6 +35,8 @@ script = ExtResource( 5 )
|
|||
title = "Shady Canopy"
|
||||
shard_titles = [ "Archer and His Friend", "Thirsty Spiders", "Spider's Den", "Dancing Above the Pond", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "canopy"
|
||||
shards_required = 0
|
||||
boss_required = ""
|
||||
boss = false
|
||||
scores_id = 13254
|
||||
times_id = 13257
|
||||
|
@ -44,6 +48,8 @@ script = ExtResource( 5 )
|
|||
title = "Echo Mountain"
|
||||
shard_titles = [ "Push the Rock", "Twin Rolling Fiends", "Beware! Moving Platforms", "Crafty CatBat", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "mountain"
|
||||
shards_required = 0
|
||||
boss_required = ""
|
||||
boss = false
|
||||
scores_id = 13263
|
||||
times_id = 13270
|
||||
|
@ -55,6 +61,8 @@ script = ExtResource( 5 )
|
|||
title = "VS The Scrump"
|
||||
shard_titles = [ "-w-", "owo", "uwu", "o3o", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "boss1"
|
||||
shards_required = 0
|
||||
boss_required = ""
|
||||
boss = true
|
||||
scores_id = -1
|
||||
times_id = -1
|
||||
|
@ -66,6 +74,8 @@ script = ExtResource( 5 )
|
|||
title = "Blue Ray Cavern"
|
||||
shard_titles = [ "Dynamic Duo", "Stalactite Scramble", "OverHead Obstacle Course", "Sneaky Snail", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "cave"
|
||||
shards_required = 0
|
||||
boss_required = "boss1"
|
||||
boss = false
|
||||
scores_id = 13264
|
||||
times_id = 13271
|
||||
|
@ -77,6 +87,8 @@ script = ExtResource( 5 )
|
|||
title = "Crater of the Abyss"
|
||||
shard_titles = [ "Follow the minnow", "Beel enclosure", "Turchin jump", "Drop Down Mine Jump", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "abyss"
|
||||
shards_required = 0
|
||||
boss_required = "boss1"
|
||||
boss = false
|
||||
scores_id = 13265
|
||||
times_id = 13272
|
||||
|
@ -88,6 +100,8 @@ script = ExtResource( 5 )
|
|||
title = "ArlingWood Graveyard"
|
||||
shard_titles = [ "Bone Climb", "Soul Graze", "Bow Happy Hellarcher", "Look out for spikes!", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "graveyard"
|
||||
shards_required = 0
|
||||
boss_required = "boss1"
|
||||
boss = false
|
||||
scores_id = 13266
|
||||
times_id = 13273
|
||||
|
@ -99,6 +113,8 @@ script = ExtResource( 5 )
|
|||
title = "VS. STG-2600"
|
||||
shard_titles = [ "", "", "", "", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "boss2"
|
||||
shards_required = 0
|
||||
boss_required = ""
|
||||
boss = true
|
||||
scores_id = -1
|
||||
times_id = -1
|
||||
|
@ -110,6 +126,8 @@ script = ExtResource( 5 )
|
|||
title = "Dread PD"
|
||||
shard_titles = [ "All Cops Are Bastards", "Save Ms.X", "Treacherous Climb", "Dodge the lasers", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "station"
|
||||
shards_required = 0
|
||||
boss_required = "boss2"
|
||||
boss = false
|
||||
scores_id = 13267
|
||||
times_id = 13274
|
||||
|
@ -121,6 +139,8 @@ script = ExtResource( 5 )
|
|||
title = "Rust Inc."
|
||||
shard_titles = [ "Precarious Block", "Beside the button", "Saws and bullets", "Beyond the Steam", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "rust"
|
||||
shards_required = 0
|
||||
boss_required = "boss2"
|
||||
boss = false
|
||||
scores_id = 13268
|
||||
times_id = 13275
|
||||
|
@ -132,6 +152,8 @@ script = ExtResource( 5 )
|
|||
title = "Fami's Lab"
|
||||
shard_titles = [ "Jump the Spike", "Final Obstacle Course", "5-Finger Discount", "Partners in law", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "lab"
|
||||
shards_required = 0
|
||||
boss_required = "boss2"
|
||||
boss = false
|
||||
scores_id = 13269
|
||||
times_id = 13276
|
||||
|
@ -143,6 +165,8 @@ script = ExtResource( 5 )
|
|||
title = "Beta Verdant Hills"
|
||||
shard_titles = [ "Climb the Big Vine", "Next to the Lone Tree", "Slime's Treasure", "The Snake Pit", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "beta_hills"
|
||||
shards_required = 0
|
||||
boss_required = ""
|
||||
boss = false
|
||||
scores_id = -1
|
||||
times_id = -1
|
||||
|
@ -154,6 +178,8 @@ script = ExtResource( 5 )
|
|||
title = "Beta Blue Ray Cavern"
|
||||
shard_titles = [ "Star-Crossed Lovers", "The Snail Cave", "Members Only!", "OverHead Obstacle Course", "5 Rainbow Stars", "Collection Bonus", "Time Bonus", "Life Bonus" ]
|
||||
save_id = "beta_cave"
|
||||
shards_required = 0
|
||||
boss_required = ""
|
||||
boss = false
|
||||
scores_id = -1
|
||||
times_id = -1
|
||||
|
|
|
@ -18,6 +18,8 @@ class LevelSaveData:
|
|||
# collectibles
|
||||
var keys_collected: int = 0
|
||||
var shards_collected: Array
|
||||
# whether level has been beaten at all
|
||||
var completed: bool = false
|
||||
|
||||
func _init(id: String) -> void:
|
||||
save_id = id
|
||||
|
@ -42,6 +44,8 @@ class LevelSaveData:
|
|||
# set collected shards
|
||||
for i in 8:
|
||||
file.set_value(save_id, "shard_%d" % i, shards_collected[i])
|
||||
# set completion status
|
||||
file.set_value(save_id, "completed", completed)
|
||||
|
||||
## loads level data from the given ConfigFile
|
||||
func load_from_file(file: ConfigFile) -> void:
|
||||
|
@ -58,6 +62,8 @@ class LevelSaveData:
|
|||
# get collected shards
|
||||
for i in 8:
|
||||
shards_collected[i] = file.get_value(save_id, "shard_%d" % i, false)
|
||||
# get completion status
|
||||
completed = file.get_value(save_id, "completed", false)
|
||||
|
||||
# contains data of one save file
|
||||
class SaveFile:
|
||||
|
|
|
@ -17,7 +17,7 @@ func _on_Boss1_entered_phase(phase):
|
|||
$DelayedArrow3.start()
|
||||
4:
|
||||
$ExitTimer.start()
|
||||
if Debug.prey_slaughtered == false:
|
||||
if not Debug.prey_slaughtered:
|
||||
var text_3d = Text3D.instance()
|
||||
text_3d.anim = "victory"
|
||||
self.add_child(text_3d)
|
||||
|
@ -29,5 +29,5 @@ func _on_Boss1_entered_phase(phase):
|
|||
|
||||
|
||||
func _on_ExitTimer_timeout():
|
||||
Game.save()
|
||||
Game.save_boss()
|
||||
Game.change_map(load("res://menus/level_select_scholar.tscn"))
|
||||
|
|
|
@ -20,5 +20,5 @@ func _on_2600_entered_phase(phase):
|
|||
|
||||
|
||||
func _on_ExitTimer_timeout():
|
||||
Game.save()
|
||||
Game.save_boss()
|
||||
Game.change_map(load("res://menus/level_select_scholar.tscn"))
|
||||
|
|
|
@ -10,6 +10,8 @@ export var shard_titles: Array = [
|
|||
"Time Bonus",
|
||||
"Life Bonus"]
|
||||
export var save_id: String = ""
|
||||
export var shards_required: int = 0
|
||||
export var boss_required: String = ""
|
||||
export var boss: bool = false
|
||||
export var scores_id: int = -1
|
||||
export var times_id: int = -1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue