diff --git a/scenes/globals/gui_manager.tscn b/scenes/globals/gui_manager.tscn index ee5a05d..fe7a5b3 100644 --- a/scenes/globals/gui_manager.tscn +++ b/scenes/globals/gui_manager.tscn @@ -236,25 +236,6 @@ offset_right = 633.0 offset_bottom = 146.0 text = "You are a God!" -[node name="LevelUpNotificationLabel" type="Label" parent="GameHud"] -visible = false -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -52.5 -offset_top = -17.0 -offset_right = 52.5 -offset_bottom = 17.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 4 -theme_override_font_sizes/font_size = 24 -text = "Level UP!" -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="BlackHoleWarningLabel" type="Label" parent="GameHud"] modulate = Color(1, 0, 0, 1) anchors_preset = 8 diff --git a/scripts/game/level.gd b/scripts/game/level.gd index 8857cbe..f0eddd5 100644 --- a/scripts/game/level.gd +++ b/scripts/game/level.gd @@ -247,7 +247,7 @@ func _physics_process(delta): if time_left < 1: if portal_active == false: portal_active = true - portal_timer = portal_duration_seconds ### GPT + portal_timer = portal_duration_seconds Singleton.gui_manager.hud_portal_active.visible = true Singleton.gui_manager.hud_timer_bar.get("theme_override_styles/fill").bg_color = Color.hex(0xb4b542ff) _open_portal() diff --git a/scripts/globals/gui_manager.gd b/scripts/globals/gui_manager.gd index 8d0fd75..b200f13 100644 --- a/scripts/globals/gui_manager.gd +++ b/scripts/globals/gui_manager.gd @@ -44,7 +44,6 @@ const STATS_TABLE_GROUP := "stats_table_layer" @onready var hud_timer_text: Label = $GameHud/HudTimerText @onready var hud_portal_active: Label = $GameHud/HudPortalActive @onready var hud_god_mode: Label = $GameHud/HudGodMode -@onready var level_up_notification_label: Label = $GameHud/LevelUpNotificationLabel @onready var black_hole_warning_label: Label = $GameHud/BlackHoleWarningLabel # Elementos exibidos na tela de Game Over. @@ -484,35 +483,6 @@ func show_pause_overlay_only() -> void: pause_menu_layer.visible = true -## Exibe uma notificação de "Level Up" no HUD. -## Parâmetros: -## - message: Texto a ser mostrado na notificação. -## Comportamento: -## - Garante que o Label `level_up_notification_label` é válido. -## - Atualiza o texto do Label e o torna visível, mas inicialmente -## com alpha = 0 (invisível). -## - Cria uma animação (Tween) que faz: -## 1. Fade in rápido (0.15s). -## 2. Pausa (1.0s). -## 3. Fade out suave (0.35s). -## - Quando o Tween termina, esconde novamente o Label -## para evitar que permaneça visível. -func show_level_up_notice(message: String) -> void: - if not is_instance_valid(level_up_notification_label): - return - level_up_notification_label.text = message - level_up_notification_label.visible = true - level_up_notification_label.modulate.a = 0.0 - var fade_tween := get_tree().create_tween() - fade_tween.tween_property(level_up_notification_label, "modulate:a", 1.0, 0.15) - fade_tween.tween_interval(1.0) - fade_tween.tween_property(level_up_notification_label, "modulate:a", 0.0, 0.35) - fade_tween.finished.connect(func (): - if is_instance_valid(level_up_notification_label): - level_up_notification_label.visible = false - ) - - ## Abre o seletor de upgrades (picker). ## - Garante existência de `upgrades_menu` e do nó `SelectUpgrades`. ## - Torna-os visíveis/ativos, repopula as cartas e pausa o jogo. diff --git a/scripts/player/player.gd b/scripts/player/player.gd index 0587b3b..6a97be2 100644 --- a/scripts/player/player.gd +++ b/scripts/player/player.gd @@ -143,7 +143,8 @@ func _init_level_progress() -> void: if is_instance_valid(Singleton.level) and Singleton.level.has_method("get_score"): var score = Singleton.level.get_score() var level_index := _level_for_score(score) - _apply_level_up_to(level_index, false) + + _apply_level_up_to(level_index) current_level_index = level_index @@ -154,11 +155,11 @@ func _init_level_progress() -> void: func _update_level_from_score(score: int) -> void: var target_index := _level_for_score(score) if current_level_index < 0: - _apply_level_up_to(target_index, false) + _apply_level_up_to(target_index) current_level_index = target_index return if target_index > current_level_index: - _apply_level_up_to(target_index, true) + _apply_level_up_to(target_index) current_level_index = target_index if target_index >= 1: Singleton.gui_manager.open_upgrades_picker() @@ -182,35 +183,19 @@ func _level_for_score(current_score: int) -> int: ## Aplica os desbloqueios de turrets até o nível especificado. -## Parâmetros: -## - target_level_index: índice máximo de nível a ser aplicado. -## - notify: se true, mostra uma mensagem de Level Up ao desbloquear. -## Comportamento: ## - Itera por todos os níveis do índice 0 até `target_level_index`. ## - Para cada nível, percorre a lista de turrets em `unlock` e habilita ## (define `current_bullet = 1`) as turrets correspondentes no dicionário `turrets`. ## - Se `notify` for true e o nível possuir `min_score > 0`, gera uma mensagem ## descrevendo quais turrets foram adicionadas e chama `show_level_up_notice` ## no `gui_manager` para exibir o aviso na tela. -func _apply_level_up_to(target_level_index: int, notify: bool = true) -> void: +func _apply_level_up_to(target_level_index: int) -> void: for level_index in range(target_level_index + 1): var turrets_to_unlock: Array = PLAYER_LEVELS[level_index]["unlock"] for turret_direction in turrets_to_unlock: var turret_node = turrets.get(turret_direction, null) if is_instance_valid(turret_node): - if turret_node.current_bullet == 0: - turret_node.current_bullet = selected_weapon_id - if ( - notify - and int(PLAYER_LEVELS[level_index]["min_score"]) > 0 - and is_instance_valid(Singleton.gui_manager) - and Singleton.gui_manager.has_method("show_level_up_notice") - ): - var unlocked_parts: Array[String] = [] - for turret_direction in turrets_to_unlock: - unlocked_parts.append("Turret " + String(turret_direction) + " Added!") - var message := "Level up! " + ", ".join(unlocked_parts) - Singleton.gui_manager.show_level_up_notice(message) + turret_node.current_bullet = 1 ## Atualiza a física e o estado geral do Player a cada frame.