fix collection bonus

This commit is contained in:
Haze Weathers 2023-10-05 21:04:51 -04:00
parent 2b37a68f14
commit fe09f34bf8

View file

@ -105,10 +105,10 @@ func tally_scores() -> void:
# collection bonus
if keys >= 50:
collection_bonus += 500
if shards >= 5:
if _get_shards() >= 5:
collection_bonus += 500
# 100% collection
if keys >= 50 and shards >= 5:
if keys >= 50 and _get_shards() >= 5:
collection_bonus += 250
shards_collected[5] = true
# 100% time bonus
@ -131,6 +131,7 @@ func tally_scores() -> void:
perfect_bonus += 1000
# final score
final_score = score + arrows_bonus + collection_bonus + time_bonus + life_bonus + perfect_bonus
print(collection_bonus)
Game.save()
@ -176,7 +177,7 @@ func save():
var save_data: Save.LevelSaveData = Save.current_file.levels[save_id]
# save score and time depending on completion
if shards >= 5 && keys >= 50:
if _get_shards() >= 5 && keys >= 50:
save_data.score_100 = max(save_data.score_100, final_score)
save_data.time_100 = min(save_data.time_100, time)
else:
@ -230,7 +231,7 @@ func freeze_frame(time):
#Check if 100%ed
func has_collection_bonus():
return shards == 5 && keys == 50
return _get_shards() == 5 && keys == 50
# called when player dies
func _on_player_died() -> void: