From f54d0a9731b3fa9466d6d424eca302433919b196 Mon Sep 17 00:00:00 2001 From: PAPerfilTeste <110242063+PArthur006@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:41:09 -0300 Subject: [PATCH 1/2] =?UTF-8?q?Coment=C3=A1rios=20acrescentados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Acrescentei comentários para facilitar nas futuras alterações no projeto. --- Sunflower-Knight/Scenes/fase_2.tscn | 25 +++++---- Sunflower-Knight/scripts/dialog_box.gd | 52 ++++++++++++------- Sunflower-Knight/scripts/door.gd | 31 +++++++---- Sunflower-Knight/scripts/falling_platform.gd | 48 ++++++++++------- Sunflower-Knight/scripts/game_over.gd | 8 +-- Sunflower-Knight/scripts/key.gd | 20 ++----- Sunflower-Knight/scripts/key_manager.gd | 2 +- Sunflower-Knight/scripts/limite.gd | 33 +++--------- .../scripts/moving_plataform_2.gd | 23 +++++++- Sunflower-Knight/scripts/moving_platform.gd | 26 ++++++++-- Sunflower-Knight/scripts/player.gd | 16 ++++-- Sunflower-Knight/scripts/title_screen.gd | 18 +++---- Sunflower-Knight/scripts/warning_sign.gd | 19 ++++--- 13 files changed, 191 insertions(+), 130 deletions(-) diff --git a/Sunflower-Knight/Scenes/fase_2.tscn b/Sunflower-Knight/Scenes/fase_2.tscn index a96c111..9af6b93 100644 --- a/Sunflower-Knight/Scenes/fase_2.tscn +++ b/Sunflower-Knight/Scenes/fase_2.tscn @@ -25,23 +25,26 @@ [sub_resource type="GDScript" id="GDScript_80mvv"] script/source = "extends Node2D -@onready var anim := $Animation as AnimationPlayer -@onready var respawn_timer := $Respawn as Timer -@onready var respawn_position := global_position +# Inicialização de nós e variáveis +@onready var anim := $Animation as AnimationPlayer # Controla as animações da fase, se necessário +@onready var respawn_timer := $Respawn as Timer # Temporizador para o respawn +@onready var respawn_position := global_position # Guarda a posição inicial para o respawn -@export var reset_timer := 3.0 +@export var reset_timer := 3.0 # Tempo (em segundos) para o respawn -var velocity := Vector2.ZERO -var gravity = ProjectSettings.get_setting(\"physics/2d/default_gravity\") -var is_triggered := false +# Controle de movimento e estado +var velocity := Vector2.ZERO # Armazena a velocidade da fase (ou objeto relacionado) +var gravity = ProjectSettings.get_setting(\"physics/2d/default_gravity\") # Obtém a gravidade padrão do projeto +var is_triggered := false # Indica se o evento já foi acionado +# Desativa o processamento de física ao iniciar func _ready() -> void: - set_physics_process(false) - + set_physics_process(false) # A física só será ativada quando necessário +# Processamento físico: aplica gravidade e movimenta o nó func _physics_process(delta): - velocity.y += gravity * delta - position += velocity * delta + velocity.y += gravity * delta # Aplica a gravidade ao vetor de velocidade + position += velocity * delta # Move o objeto com base na velocidade calculada " [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_x3dco"] diff --git a/Sunflower-Knight/scripts/dialog_box.gd b/Sunflower-Knight/scripts/dialog_box.gd index a840344..ba116c6 100644 --- a/Sunflower-Knight/scripts/dialog_box.gd +++ b/Sunflower-Knight/scripts/dialog_box.gd @@ -1,54 +1,68 @@ extends MarginContainer -@onready var text_label: Label = $label_margin/text_label -@onready var letter_timer_display: Timer = $letter_timer_display +# Referências aos nós necessários +@onready var text_label: Label = $label_margin/text_label # Rótulo onde o texto será exibido +@onready var letter_timer_display: Timer = $letter_timer_display # Timer para exibir as letras gradualmente -const MAX_WIDTH = 256 +const MAX_WIDTH = 256 # Largura máxima da caixa de diálogo -var text = "" -var letter_index = 0 +# Variáveis para controle do texto +var text = "" # Armazena o texto a ser exibido +var letter_index = 0 # Índice atual da letra sendo exibida -var letter_display_timer := 0.07 -var space_display_timer := 0.05 -var punctuaction_display_timer := 0.2 +# Tempos para exibição de letras, espaços e pontuações +var letter_display_timer := 0.07 # Tempo entre cada letra +var space_display_timer := 0.05 # Tempo entre cada espaço +var punctuaction_display_timer := 0.2 # Tempo maior para pontuações +# Sinal emitido quando todo o texto for exibido signal text_display_finished() +# Função para iniciar a exibição do texto func display_text(text_to_display: String): - text = text_to_display - text_label.text = text_to_display + text = text_to_display # Armazena o texto recebido + text_label.text = text_to_display # Define o texto completo inicialmente - await resized + await resized # Aguarda o redimensionamento para ajustar a interface + # Ajusta a largura mínima para não ultrapassar o limite máximo custom_minimum_size.x = min(size.x, MAX_WIDTH) + # Se a largura exceder o limite, aplica a quebra automática de linha if size.x > MAX_WIDTH: text_label.autowrap_mode = TextServer.AUTOWRAP_WORD await resized - await resized + await resized # Aguarda dois ciclos de redimensionamento para garantir a exibição correta custom_minimum_size.y = size.y + # Centraliza o texto horizontalmente e posiciona acima da origem global_position.x -= size.x / 2 global_position.y -= size.y + 24 + + # Limpa o texto inicial e começa a exibição gradual text_label.text = "" display_letter() - + +# Função que exibe as letras uma a uma func display_letter(): + # Adiciona a letra atual ao texto visível text_label.text += text[letter_index] - letter_index += 1 + letter_index += 1 # Avança para a próxima letra + # Se todas as letras foram exibidas, emite o sinal de finalização if letter_index >= text.length(): text_display_finished.emit() return + # Determina o tempo de exibição com base no caractere atual match text[letter_index]: - "!", "?", ",", ".": + "!", "?", ",", ".": # Pontuações recebem um tempo maior letter_timer_display.start(punctuaction_display_timer) - " ": + " ": # Espaços têm um tempo ligeiramente menor letter_timer_display.start(space_display_timer) - _: + _: # Letras comuns seguem o tempo padrão letter_timer_display.start(letter_display_timer) - +# Função chamada automaticamente quando o timer termina func _on_letter_timer_display_timeout() -> void: - display_letter() + display_letter() # Exibe a próxima letra diff --git a/Sunflower-Knight/scripts/door.gd b/Sunflower-Knight/scripts/door.gd index 36acaec..07cc9b6 100644 --- a/Sunflower-Knight/scripts/door.gd +++ b/Sunflower-Knight/scripts/door.gd @@ -1,26 +1,37 @@ extends StaticBody2D -@export var next_level: String = "res://Scenes/fase_2.tscn" # Caminho da próxima fase +# Caminho da próxima fase; pode ser definido no editor +@export var next_level: String = "res://Scenes/fase_2.tscn" + +# Referência ao nó que exibe a mensagem de necessidade da chave @onready var message_key = $ColorRect +# Inicialização do nó func _ready(): - $Area2D.body_entered.connect(_on_body_entered) # Conectar o evento + # Conecta o sinal de detecção de entrada na área ao método correspondente + $Area2D.body_entered.connect(_on_body_entered) + +# Exibe a mensagem informando que a chave é necessária func show_message_key(): - message_key.visible = true - await get_tree().create_timer(2.0).timeout # Espera 2 segundos - message_key.visible = false # Esconde a mensagem + message_key.visible = true # Torna a mensagem visível + await get_tree().create_timer(2.0).timeout # Aguarda 2 segundos + message_key.visible = false # Esconde a mensagem após o tempo definido +# Função chamada ao detectar a entrada de um corpo na área func _on_body_entered(body): + # Verifica se o corpo que entrou é o jogador if body.is_in_group("Player"): + # Verifica se o jogador possui a chave necessária if KeyManager.key: - print("Porta aberta!") - $CollisionShape2D.disabled = true # Desativa a colisão física - queue_free() # Remove a porta visualmente + print("Porta aberta!") # Log no console + $CollisionShape2D.disabled = true # Desativa a colisão da porta + queue_free() # Remove a porta da cena print("Passando para a próxima fase!") - get_tree().change_scene_to_file(next_level) # Muda de fase + get_tree().change_scene_to_file(next_level) # Muda para a fase indicada else: - print("Você precisa de uma chave!") # Mensagem no console + # Caso não tenha a chave, exibe uma mensagem de aviso + print("Você precisa de uma chave!") show_message_key() diff --git a/Sunflower-Knight/scripts/falling_platform.gd b/Sunflower-Knight/scripts/falling_platform.gd index abe9474..328fc0b 100644 --- a/Sunflower-Knight/scripts/falling_platform.gd +++ b/Sunflower-Knight/scripts/falling_platform.gd @@ -1,37 +1,47 @@ extends AnimatableBody2D -@onready var anim := $anim as AnimationPlayer -@onready var respawn_timer := $respawn as Timer -@onready var respawn_position := global_position +# Inicialização de nós e variáveis +@onready var anim := $anim as AnimationPlayer # Controla as animações da plataforma +@onready var respawn_timer := $respawn as Timer # Temporizador para respawn da plataforma +@onready var respawn_position := global_position # Posição inicial para o respawn -@export var reset_timer := 3.0 +@export var reset_timer := 3.0 # Tempo (em segundos) para a plataforma reaparecer -var velocity := Vector2.ZERO -var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") -var is_triggered := false +# Velocidade e gravidade +var velocity := Vector2.ZERO # Velocidade vertical da plataforma +var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") # Obtém a gravidade padrão do projeto +var is_triggered := false # Indica se a plataforma foi ativada (balançou e caiu) +# Desativa o processamento de física ao iniciar func _ready(): set_physics_process(false) +# Processamento físico: aplica gravidade e move a plataforma func _physics_process(delta: float) -> void: - velocity.y += gravity * delta - position += velocity * delta + velocity.y += gravity * delta # Aumenta a velocidade devido à gravidade + position += velocity * delta # Move a plataforma com base na velocidade calculada +# Verifica se houve colisão com o jogador func has_collided_with(collision: KinematicCollision2D, collider: CharacterBody2D): + # Ativa a plataforma apenas na primeira colisão if !is_triggered: is_triggered = true - anim.play("shake") - velocity = Vector2.ZERO - + anim.play("shake") # Inicia a animação de "balançar" + velocity = Vector2.ZERO # Reseta a velocidade para evitar movimentos indevidos +# Quando a animação termina, inicia a queda func _on_anim_animation_finished(anim_name: StringName) -> void: - set_physics_process(true) - respawn_timer.start(reset_timer) - + set_physics_process(true) # Ativa o processamento de física, permitindo a queda + respawn_timer.start(reset_timer) # Inicia o temporizador para o respawn + +# Quando o temporizador expira, reposiciona e reseta a plataforma func _on_respawn_timeout() -> void: - set_physics_process(false) - global_position = respawn_position + set_physics_process(false) # Desativa a física para reposicionar corretamente + global_position = respawn_position # Retorna a plataforma à posição inicial + + # Anima o reaparecimento da plataforma com um efeito de crescimento if is_triggered: - var spawn_tween= create_tween().set_trans(Tween.TRANS_BOUNCE).set_ease(Tween.EASE_IN_OUT) + var spawn_tween = create_tween().set_trans(Tween.TRANS_BOUNCE).set_ease(Tween.EASE_IN_OUT) spawn_tween.tween_property($texture, "scale", Vector2(1, 1), 0.2).from(Vector2(0, 0)) - is_triggered = false + + is_triggered = false # Reseta o estado da plataforma diff --git a/Sunflower-Knight/scripts/game_over.gd b/Sunflower-Knight/scripts/game_over.gd index afcf55c..a6231ff 100644 --- a/Sunflower-Knight/scripts/game_over.gd +++ b/Sunflower-Knight/scripts/game_over.gd @@ -1,9 +1,11 @@ extends Control - +# Função chamada ao pressionar o botão de reinício func _on_restart_btn_pressed() -> void: - get_tree() .change_scene_to_file("res://Scenes/title_screen.tscn") - + # Retorna o jogador para a tela inicial do jogo + get_tree().change_scene_to_file("res://Scenes/title_screen.tscn") +# Função chamada ao pressionar o botão de sair func _on_quit_btn_pressed() -> void: + # Encerra o jogo get_tree().quit() diff --git a/Sunflower-Knight/scripts/key.gd b/Sunflower-Knight/scripts/key.gd index 7bea253..ead8beb 100644 --- a/Sunflower-Knight/scripts/key.gd +++ b/Sunflower-Knight/scripts/key.gd @@ -1,23 +1,11 @@ extends AnimatedSprite2D - -# Called when the node enters the scene tree for the first time. -func _ready() -> void: - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass - - +# Função chamada ao detectar a entrada de um corpo na área da chave func _on_area_2d_body_entered(body: Node2D) -> void: + # Verifica se o corpo que entrou pertence ao grupo "Player" if body.is_in_group('Player'): + # Define a variável "key" no KeyManager como verdadeira, indicando que o jogador pegou a chave KeyManager.key = true print("Chave coletada! key =", KeyManager.key) + # Remove a chave da cena após ser coletada queue_free() - - - - - diff --git a/Sunflower-Knight/scripts/key_manager.gd b/Sunflower-Knight/scripts/key_manager.gd index 88c70c5..76212cb 100644 --- a/Sunflower-Knight/scripts/key_manager.gd +++ b/Sunflower-Knight/scripts/key_manager.gd @@ -1,4 +1,4 @@ extends Node - +# Controla se o jogador possui a chave (true = tem a chave, false = não tem) var key = false diff --git a/Sunflower-Knight/scripts/limite.gd b/Sunflower-Knight/scripts/limite.gd index c753936..9c91140 100644 --- a/Sunflower-Knight/scripts/limite.gd +++ b/Sunflower-Knight/scripts/limite.gd @@ -1,35 +1,16 @@ extends Area2D +# Armazena o caminho da cena atual, para possível controle de reinício var current_scene = "" - func _ready(): - current_scene = get_tree().current_scene.scene_file_path #pega em qual fase está - print (current_scene) + # Obtém o caminho do arquivo da cena atual ao iniciar + current_scene = get_tree().current_scene.scene_file_path + print("Cena atual:", current_scene) func _on_body_entered(body): + # Verifica se o corpo que entrou na área pertence ao grupo "Player" if body.is_in_group("Player"): + # Aciona a função de morte do jogador (normalmente lida com vidas e reposicionamento) body.die() - print("jogador caiu! na fase:", current_scene) - - - - - - - - - - - - - - - #if current_scene == "res://Scenes/fase_1.tscn": - #get_tree().change_scene_to_file("res://Scenes/fase_1.tscn") #esta voltando do zero - - #if current_scene == "res://Scenes/fase_2.tscn": - #get_tree().change_scene_to_file("res://Scenes/fase_2.tscn") - -# da pra adicionar uma transicao de GAMEOVER aqui e voltar para o menu -# POR ENQUANTO NAO ESTA CONSIDERANDO ViDAS, pois o script do player esta incompleto + print("Jogador caiu na fase:", current_scene) diff --git a/Sunflower-Knight/scripts/moving_plataform_2.gd b/Sunflower-Knight/scripts/moving_plataform_2.gd index 1c9ae50..55afee9 100644 --- a/Sunflower-Knight/scripts/moving_plataform_2.gd +++ b/Sunflower-Knight/scripts/moving_plataform_2.gd @@ -1,27 +1,46 @@ extends Node2D +# Tempo de espera no fim do movimento da plataforma const WAIT_DURATION := 1.0 +# Referência ao corpo da plataforma @onready var platform := $platform as AnimatableBody2D + +# Velocidade de movimento da plataforma @export var move_speed := 3.0 + +# Distância que a plataforma percorrerá @export var distance := 192 + +# Define se a plataforma se moverá na horizontal (true) ou na vertical (false) @export var move_horizontal := true +# Ponto de destino atual da plataforma var follow := Vector2.ZERO + +# Fator usado para calcular a duração do movimento com base no tamanho da plataforma var platform_center := 16 func _ready() -> void: + # Inicia o movimento da plataforma ao carregar a cena move_platform() - -# Called every frame. 'delta' is the elapsed time since the previous frame. func _physics_process(delta: float) -> void: + # Move a plataforma suavemente em direção ao ponto definido (follow) platform.position = platform.position.lerp(follow, 0.5) func move_platform(): + # Define a direção do movimento: horizontal (direita) ou vertical (para cima) var move_direction = Vector2.RIGHT * distance if move_horizontal else Vector2.UP * distance + + # Calcula a duração com base na distância e na velocidade definida var duration = move_direction.length() / float(move_speed * platform_center) + # Cria uma animação de movimento repetitiva e linear, indo e voltando var platform_tween = create_tween().set_loops().set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_IN_OUT) + + # Move a plataforma até o ponto máximo platform_tween.tween_property(self, "follow", move_direction, duration).set_delay(duration + WAIT_DURATION + 1) + + # Retorna a plataforma para a posição inicial após o tempo de espera platform_tween.tween_property(self, "follow", Vector2.ZERO, duration).set_delay(duration + WAIT_DURATION + 1) diff --git a/Sunflower-Knight/scripts/moving_platform.gd b/Sunflower-Knight/scripts/moving_platform.gd index c8d1699..3308348 100644 --- a/Sunflower-Knight/scripts/moving_platform.gd +++ b/Sunflower-Knight/scripts/moving_platform.gd @@ -1,28 +1,46 @@ extends Node2D +# Tempo de espera no fim do movimento da plataforma const WAIT_DURATION := 1.0 +# Referência ao corpo da plataforma @onready var platform := $platfom as AnimatableBody2D + +# Velocidade de movimento da plataforma @export var move_speed := 5.0 + +# Distância que a plataforma percorrerá @export var distance := 192 + +# Define se a plataforma se moverá na horizontal (true) ou na vertical (false) @export var move_horizontal := true +# Ponto de destino atual da plataforma var follow := Vector2.ZERO + +# Fator usado para calcular a duração do movimento com base no tamanho da plataforma var platform_center := 8 -# Called when the node enters the scene tree for the first time. func _ready() -> void: + # Inicia o movimento da plataforma ao carregar a cena move_platform() - - + func move_platform(): + # Define a direção do movimento: horizontal (direita) ou vertical (para cima) var move_direction = Vector2.RIGHT * distance if move_horizontal else Vector2.UP * distance + + # Calcula a duração com base na distância e na velocidade definida var duration = move_direction.length() / float(move_speed * platform_center) + # Cria uma animação de movimento repetitiva e linear, indo e voltando var platform_tween = create_tween().set_loops().set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_IN_OUT) + + # Move a plataforma até o ponto máximo platform_tween.tween_property(self, "follow", move_direction, duration).set_delay(WAIT_DURATION) + + # Retorna a plataforma para a posição inicial após o tempo de espera platform_tween.tween_property(self, "follow", Vector2.ZERO, duration).set_delay(WAIT_DURATION) -# Called every frame. 'delta' is the elapsed time since the previous frame. func _physics_process(delta: float) -> void: + # Move a plataforma suavemente em direção ao ponto definido (follow) platform.position = platform.position.lerp(follow, 0.5) diff --git a/Sunflower-Knight/scripts/player.gd b/Sunflower-Knight/scripts/player.gd index 8ea3ce9..730ef4a 100644 --- a/Sunflower-Knight/scripts/player.gd +++ b/Sunflower-Knight/scripts/player.gd @@ -96,17 +96,27 @@ func take_damage(amount: int): #GAME OVER func die(): + # Marca o jogador como morto death = true print("O jogador morreu") + + # Reduz uma vida lives -= 1 - print("vidas restantes:", lives) + print("Vidas restantes:", lives) + + # Aguarda 1 segundo antes de continuar a execução await get_tree().create_timer(1.0).timeout + + # Reativa o jogador após o tempo de espera death = false + + # Verifica se ainda há vidas restantes if lives > 0: print("Reaparecendo na posição inicial") - health = 100 # Restaura a vida - global_position = start_position # Retorna à posição inicial + health = 100 # Restaura a vida ao máximo + global_position = start_position # Retorna o jogador à posição inicial else: + # Se não houver vidas, muda para a cena de game over get_tree().change_scene_to_file("res://Scenes/game_over.tscn") #ANIMAÇÕES diff --git a/Sunflower-Knight/scripts/title_screen.gd b/Sunflower-Knight/scripts/title_screen.gd index 770780a..f8b59e2 100644 --- a/Sunflower-Knight/scripts/title_screen.gd +++ b/Sunflower-Knight/scripts/title_screen.gd @@ -1,23 +1,21 @@ extends Control - -# Called when the node enters the scene tree for the first time. +# Função chamada quando a tela de título é carregada func _ready() -> void: - pass # Replace with function body. - + pass # Nenhuma ação necessária no momento ao iniciar a tela -# Called every frame. 'delta' is the elapsed time since the previous frame. +# Função chamada a cada quadro (frame) func _process(delta: float) -> void: - pass - + pass # Não há atualizações necessárias por frame neste momento +# Inicia o jogo ao pressionar o botão "Start" func _on_start_btn_pressed() -> void: get_tree().change_scene_to_file("res://Scenes/fase_1.tscn") - +# Exibe os créditos ao pressionar o botão "Credits" (a ser implementado) func _on_credits_btn_pressed() -> void: - pass # Replace with function body. - + pass # Implementar a lógica de exibição dos créditos posteriormente +# Encerra o jogo ao pressionar o botão "Quit" func _on_quit_btn_pressed() -> void: get_tree().quit() diff --git a/Sunflower-Knight/scripts/warning_sign.gd b/Sunflower-Knight/scripts/warning_sign.gd index bda40c5..f4fc769 100644 --- a/Sunflower-Knight/scripts/warning_sign.gd +++ b/Sunflower-Knight/scripts/warning_sign.gd @@ -1,8 +1,10 @@ extends Node2D +# Referências para o sprite de interação e a área de detecção @onready var texture: Sprite2D = $texture @onready var area_sign: Area2D = $area_sign +# Mensagens exibidas no diálogo const lines: Array[String] = [ "Mesmo nas trevas,", "um girassol resiste...", @@ -12,20 +14,25 @@ const lines: Array[String] = [ "Use ▶️ para andar à direita.", "Pressione ⬆ para pular.", "Pressione espaço para atacar!", - "Coragem. Força. Determinação", + "Coragem. Força. Determinação.", "Sua jornada começa agora...", ] -#interect +# Verifica entradas não tratadas para ativar o sinal e iniciar o diálogo func _unhandled_input(event): + # Se o jogador estiver próximo (corpo dentro da área) if area_sign.get_overlapping_bodies().size() > 0: - texture.show() + texture.show() # Mostra o ícone que indica interação + + # Inicia o diálogo ao pressionar o botão de interação (ui_focus_next) if event.is_action_pressed("ui_focus_next") && !DialogManager.is_message_active: - texture.hide() + texture.hide() # Esconde o ícone após iniciar o diálogo DialogManager.start_message(global_position, lines) else: + # Esconde o ícone se não houver ninguém próximo texture.hide() + + # Fecha o diálogo se ainda existir uma caixa ativa if DialogManager.dialog_box != null: - DialogManager.dialog_box.queue.free() + DialogManager.dialog_box.queue_free() DialogManager.is_message_active = false - From 47287252d44543196aedc125c72afb456b914822 Mon Sep 17 00:00:00 2001 From: PAPerfilTeste <110242063+PArthur006@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:41:47 -0300 Subject: [PATCH 2/2] =?UTF-8?q?Scripts=20exclu=C3=ADdos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Excluí por serem desnecessários --- Sunflower-Knight/scripts/warning_sign_2.gd | 23 ------------------ Sunflower-Knight/scripts/warning_sign_3.gd | 28 ---------------------- 2 files changed, 51 deletions(-) delete mode 100644 Sunflower-Knight/scripts/warning_sign_2.gd delete mode 100644 Sunflower-Knight/scripts/warning_sign_3.gd diff --git a/Sunflower-Knight/scripts/warning_sign_2.gd b/Sunflower-Knight/scripts/warning_sign_2.gd deleted file mode 100644 index 4eea989..0000000 --- a/Sunflower-Knight/scripts/warning_sign_2.gd +++ /dev/null @@ -1,23 +0,0 @@ -extends Node2D - -@onready var texture: Sprite2D = $texture -@onready var area_sign: Area2D = $area_sign - -const lines: Array[String] = [ - "Cuidado! Inimigos à frente!", - "Aperte espaço para atacar!", -] - - -func _unhandled_input(event): - if area_sign.get_overlapping_bodies().size() > 0: - texture.show() - if event.is_action_pressed("interect") && !DialogManager.is_message_active: - texture.hide() - DialogManager.start_message(global_position, lines) - else: - texture.hide() - if DialogManager.dialog_box != null: - DialogManager.dialog_box.queue.free() - DialogManager.is_message_active = false - diff --git a/Sunflower-Knight/scripts/warning_sign_3.gd b/Sunflower-Knight/scripts/warning_sign_3.gd deleted file mode 100644 index 51b113d..0000000 --- a/Sunflower-Knight/scripts/warning_sign_3.gd +++ /dev/null @@ -1,28 +0,0 @@ -extends Node2D - -@onready var texture: Sprite2D = $texture -@onready var area_sign: Area2D = $area_sign - -const lines: Array[String] = [ - "Mesmo nas trevas,", - "um girassol resiste...", - "As trevas avançam...", - "Está pronto para enfrentá-las?", - "Use ◀️ para andar à esquerda.", - "Use ▶️ para andar à direita.", - "Pressione ⇧ para pular.", -] - - -func _unhandled_input(event): - if area_sign.get_overlapping_bodies().size() > 0: - texture.show() - if event.is_action_pressed("interect") && !DialogManager.is_message_active: - texture.hide() - DialogManager.start_message(global_position, lines) - else: - texture.hide() - if DialogManager.dialog_box != null: - DialogManager.dialog_box.queue.free() - DialogManager.is_message_active = false -