diff --git a/scripts/LeatherBoots.gd b/scripts/LeatherBoots.gd index fac088f..a1dcf32 100644 --- a/scripts/LeatherBoots.gd +++ b/scripts/LeatherBoots.gd @@ -23,6 +23,3 @@ func _process(delta: float) -> void: func interact(player: Node) -> void: player.call("apply_upgrade_boots", 2.0, tier) queue_free() - var mains := get_tree().get_nodes_in_group("main") - if not mains.is_empty(): - mains[0].call("show_tutorial", "Tutorial_LeatherBoots") diff --git a/scripts/Main.gd b/scripts/Main.gd index 082b193..2784268 100644 --- a/scripts/Main.gd +++ b/scripts/Main.gd @@ -56,6 +56,7 @@ var _equip_prev_tiers: Array[int] = [-1, -1, -1] # Boss phase var boss_active: bool = false var first_boss_spawned: bool = false +var first_bat_spawned: bool = false var boss_timer: float = 90.0 var portal_node: Node3D = null var boss_timer_label: Label @@ -277,6 +278,9 @@ func _spawn_enemy() -> void: enemy.target = player enemy.connect("died", _on_enemy_died) enemy.connect("merged", _on_enemy_merged) + if type == "bat" and not first_bat_spawned: + first_bat_spawned = true + show_tutorial("Tutorial_LeatherBoots") if type == "ogre" and not first_boss_spawned: first_boss_spawned = true _start_boss_phase() @@ -394,9 +398,11 @@ func _pick_upgrade(id: String) -> void: func _show_gameover() -> void: Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - gameover_panel.visible = true var lbl := gameover_panel.get_node("VBox/ScoreLabel") as Label lbl.text = "Score: %d\nWave: %d" % [score, wave] + show_tutorial("LoseGame", func() -> void: + gameover_panel.visible = true + ) func _restart() -> void: get_tree().paused = false @@ -409,9 +415,11 @@ func _start_boss_phase() -> void: return boss_active = true boss_timer = 120.0 - boss_timer_label.visible = true - boss_hint_label.visible = true _spawn_portal() + show_tutorial("ThirdLevelEnemy", func() -> void: + boss_timer_label.visible = true + boss_hint_label.visible = true + ) func _spawn_portal() -> void: portal_node = Node3D.new() @@ -506,9 +514,11 @@ func _trigger_win() -> void: if is_instance_valid(portal_node): portal_node.queue_free() Input.mouse_mode = Input.MOUSE_MODE_VISIBLE - get_tree().paused = true - win_panel.visible = true (win_panel.get_node("VBox/ScoreLabel") as Label).text = "Score: %d\nWave: %d" % [score, wave] + show_tutorial("VictoryScreen", func() -> void: + get_tree().paused = true + win_panel.visible = true + ) func _trigger_time_up() -> void: if not boss_active: @@ -585,8 +595,10 @@ func _set_player_paused(paused: bool) -> void: for e in get_tree().get_nodes_in_group("player"): (e as Node).process_mode = mode +const _REPEATABLE_TUTORIALS := ["VictoryScreen", "LoseGame"] + func show_tutorial(key: String, on_dismiss: Callable = Callable()) -> void: - if shown_tutorials.get(key, false): + if shown_tutorials.get(key, false) and not key in _REPEATABLE_TUTORIALS: if on_dismiss.is_valid(): on_dismiss.call() return