feat: Level reveals only after first play

This commit is contained in:
Jakob Feldmann 2023-10-10 14:00:11 +02:00
parent 1c5caa5d29
commit bf802571a2
5 changed files with 29 additions and 14 deletions

View File

@ -112,6 +112,18 @@ func get_savepoint(levelName: String) -> Vector2:
else:
return Vector2()
func was_level_touched(levelName: String) -> bool:
if OS.is_debug_build():
return true
if !gsr.progress_dict.has(levelName) || !gsr.progress_dict[levelName].has("touched"):
return false
return gsr.progress_dict[levelName]["touched"]
func touch_level(levelName: String) -> void:
if !gsr.progress_dict.has(levelName):
gsr.progress_dict[levelName] = {}
gsr.progress_dict[levelName]["touched"] = true
# TODO This is permanent immediatly
func set_wallet(value) -> void:

View File

@ -1,6 +1,6 @@
extends AudibleButton
export(String, FILE) var next_scene_path: String = ""
export(String, FILE) var next_scene_path: String = "res://src/Levels/Level 0.1.tscn"
onready var selected_level_base_path: String = "res://src/Levels/"
func _on_button_up() -> void:

View File

@ -38,6 +38,8 @@ func _fill_level_list():
func _spawn_level_options(levels: Array):
var first = true
for level in levels:
if !GlobalState.was_level_touched(LEVELS_PATH + level) && !first:
continue
var level_check_box = LEVEL_CHECK_BOX.instance()
vbox.add_child(level_check_box)
level_check_box.initialize_with_progress(LEVELS_PATH + level)

View File

@ -13,6 +13,7 @@ var is_dead := false setget set_dead
var level_time := 0.0
func _ready() -> void:
GlobalState.touch_level(levelName)
GlobalState.gsr.last_played_level = levelName
SaveManager.save_default()
signal_manager.connect("level_completed", self, "_on_level_completed")